Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.changeDpiBuffer = changeDpiBuffer;
exports.changeDpiBlob = changeDpiBlob;
exports.changeDpiDataUrl = changeDpiDataUrl;

Expand Down Expand Up @@ -51,6 +52,13 @@ var _H = 'H'.charCodeAt(0);
var _Y = 'Y'.charCodeAt(0);
var _S = 's'.charCodeAt(0);

function changeDpiBuffer(buffer, dpi, format) {
var headerChunk = buffer.slice(0, 33);
var tail = buffer.slice(33);
var changedArray = changeDpiOnArray(headerChunk, dpi, format);
return Buffer.concat([changedArray, tail]);
}

function changeDpiBlob(blob, dpi) {
// 33 bytes are ok for pngs and jpegs
// to contain the information.
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ const _H = 'H'.charCodeAt(0);
const _Y = 'Y'.charCodeAt(0);
const _S = 's'.charCodeAt(0);

export function changeDpiBuffer(buffer, dpi, format) {
const headerChunk = buffer.slice(0, 33);
const tail = buffer.slice(33);
const changedArray = changeDpiOnArray(headerChunk, dpi, format);
return Buffer.concat([changedArray, tail]);
}

export function changeDpiBlob(blob, dpi) {
// 33 bytes are ok for pngs and jpegs
// to contain the information.
Expand Down