Skip to content

Commit 28957b0

Browse files
committed
Update jspdf.plugin.addimage.js
Get the height and width of images compressed (SOS) - Start of Sca
1 parent 15523a4 commit 28957b0

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

jspdf.plugin.addimage.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ var getJpegSize = function(imgData) {
5555
if (imgData.charCodeAt(i) !== 0xff) {
5656
throw new Error('getJpegSize could not find the size of the image');
5757
}
58-
if (imgData.charCodeAt(i+1) === 0xc0) {
58+
if (imgData.charCodeAt(i+1) === 0xc0 || //(SOF) Huffman - Baseline DCT
59+
imgData.charCodeAt(i+1) === 0xc1 || //(SOF) Huffman - Extended sequential DCT
60+
imgData.charCodeAt(i+1) === 0xc2 || // Progressive DCT (SOF2)
61+
imgData.charCodeAt(i+1) === 0xc3 || // Spatial (sequential) lossless (SOF3)
62+
imgData.charCodeAt(i+1) === 0xc4 || // Differential sequential DCT (SOF5)
63+
imgData.charCodeAt(i+1) === 0xc5 || // Differential progressive DCT (SOF6)
64+
imgData.charCodeAt(i+1) === 0xc6 || // Differential spatial (SOF7)
65+
imgData.charCodeAt(i+1) === 0xc7) {
5966
height = imgData.charCodeAt(i+5)*256 + imgData.charCodeAt(i+6);
6067
width = imgData.charCodeAt(i+7)*256 + imgData.charCodeAt(i+8);
6168
return [width, height];

0 commit comments

Comments
 (0)