Skip to content

Commit a429738

Browse files
committed
comparation output
Signed-off-by: Juan Pablo Garcia Ripa <[email protected]>
1 parent 620d271 commit a429738

18 files changed

+38
-15
lines changed

packages/core/src/utils/image-bitmap.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ import FileType from "file-type";
33
import { throwError } from "@jimp/utils";
44
import EXIFParser from "exif-parser";
55
// modify-exif
6+
import modifyEXIF from "modify-exif";
67

78
import * as constants from "../constants";
89
import * as MIME from "./mime";
910
import promisify from "./promisify";
1011

1112
const EXIF_TAGS = {
1213
ORIENTATION: 0x0112, // decimal: 274
14+
IMAGE_WIDTH: 0x0100, // decimal: 256
15+
IMAGE_HEIGHT: 0x0101, // decimal: 257
1316
};
1417

1518
async function getMIMEFromBuffer(buffer, path) {
@@ -132,15 +135,18 @@ function transformBitmap(img, width, height, transformation) {
132135
}
133136
}
134137

138+
img.bitmap.data = modifyEXIF(data, (_data) => {
139+
console.log(_data);
140+
_data["0th"][274] = 1;
141+
_data["0th"][256] = width;
142+
_data["0th"][257] = height;
143+
return _data;
144+
});
145+
135146
img.bitmap.width = width;
136147
img.bitmap.height = height;
137148

138-
// img.bitmap.data = modifyEXIF(data, (_data) => {
139-
// _data["0th"][274] = 1;
140-
// return _data;
141-
// });
142-
143-
img.bitmap.data = data;
149+
// img.bitmap.data = data;
144150

145151
img._exif = EXIFParser.create(data).parse();
146152
}
-59 Bytes
Loading
-22.3 KB
Loading
-22.1 KB
Loading
391 Bytes
Loading
153 Bytes
Loading
-21.4 KB
Loading
-21 KB
Loading
-24.1 KB
Loading
-5.06 KB
Loading

0 commit comments

Comments
 (0)