Wrong file size for 4-bit RAW Grayscale file
Posted: 2016-04-10T14:32:15-07:00
When converting from JPG to TIF, Quantum Bits and XY resolution are correct:
convert bb.test.jpg -colorspace gray -resize "9x6" -depth 4 bb.test.gray.4bit.9x6.tif;
identify -quiet pic/bb.test.gray.4bit.9x6.tif
bb.test.gray.4bit.9x6.tif TIFF 9x6 9x6+0+0 4-bit Grayscale Gray 24.9KB 0.000u 0:00.009
Resolution = 9*6 = 54 pixels; 4 Quantum Bits, 1 channel grayscale. All correct
Blowing up the TIF to 5000%, the light and dark areas look right
When converting the JPG to raw, the size does not match what the XY res and QBits would produce:
Resolution = 9 wide x 6 high = 54 pixels. 1 channel, Gray, 4 bits/pixel, 54 * 4 / 8 = 27 Bytes
convert bb.test.jpg -colorspace gray -resize "9x6" -depth 4 RGB:bb.test.gray.4bit.9x6.raw;
ls -l bb.test.gray.4bit.9x6.raw
-rw-r----- 1 brianp users 84 Apr 10 15:35 bb.test.gray.4bit.9x6.raw << 84 bytes. Should be 27 bytes
Same result on windows 7
C:\bin>convert t:/pic/bb.test.jpg -colorspace gray -resize "9x6" -depth 4 RGB:bb.test.gray.4bit.9x6.raw;
C:\bin>ls -l bb.test.gray.4bit.9x6.raw
-rw-rw-rw- 1 user group 84 Apr 10 16:24 bb.test.gray.4bit.9x6.raw
How is it possible to get a 4-bit, grayscale, pure RAW image?
== VERSIONS ===================================================================
convert -version << OpenSuse 42 64-bit
Version: ImageMagick 6.9.3-7 Q16 x86_64 2016-04-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib fftw fontconfig freetype jng jpeg lcms lzma openexr pangocairo png tiff x xml zlib
identify -version
Version: ImageMagick 6.9.3-7 Q16 x86_64 2016-04-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib fftw fontconfig freetype jng jpeg lcms lzma openexr pangocairo png tiff x xml zlib
C:\bin>convert -version << windows 7 /64-bit
Version: ImageMagick 6.9.2-8 Q16 x64 2015-12-05 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangoca
iro png ps rsvg tiff webp xml zlib
convert bb.test.jpg -colorspace gray -resize "9x6" -depth 4 bb.test.gray.4bit.9x6.tif;
identify -quiet pic/bb.test.gray.4bit.9x6.tif
bb.test.gray.4bit.9x6.tif TIFF 9x6 9x6+0+0 4-bit Grayscale Gray 24.9KB 0.000u 0:00.009
Resolution = 9*6 = 54 pixels; 4 Quantum Bits, 1 channel grayscale. All correct
Blowing up the TIF to 5000%, the light and dark areas look right
When converting the JPG to raw, the size does not match what the XY res and QBits would produce:
Resolution = 9 wide x 6 high = 54 pixels. 1 channel, Gray, 4 bits/pixel, 54 * 4 / 8 = 27 Bytes
convert bb.test.jpg -colorspace gray -resize "9x6" -depth 4 RGB:bb.test.gray.4bit.9x6.raw;
ls -l bb.test.gray.4bit.9x6.raw
-rw-r----- 1 brianp users 84 Apr 10 15:35 bb.test.gray.4bit.9x6.raw << 84 bytes. Should be 27 bytes
Same result on windows 7
C:\bin>convert t:/pic/bb.test.jpg -colorspace gray -resize "9x6" -depth 4 RGB:bb.test.gray.4bit.9x6.raw;
C:\bin>ls -l bb.test.gray.4bit.9x6.raw
-rw-rw-rw- 1 user group 84 Apr 10 16:24 bb.test.gray.4bit.9x6.raw
How is it possible to get a 4-bit, grayscale, pure RAW image?
== VERSIONS ===================================================================
convert -version << OpenSuse 42 64-bit
Version: ImageMagick 6.9.3-7 Q16 x86_64 2016-04-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib fftw fontconfig freetype jng jpeg lcms lzma openexr pangocairo png tiff x xml zlib
identify -version
Version: ImageMagick 6.9.3-7 Q16 x86_64 2016-04-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib fftw fontconfig freetype jng jpeg lcms lzma openexr pangocairo png tiff x xml zlib
C:\bin>convert -version << windows 7 /64-bit
Version: ImageMagick 6.9.2-8 Q16 x64 2015-12-05 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangoca
iro png ps rsvg tiff webp xml zlib