ImageMagick: split multipage 32 float TIFF image - image-processing

I'm trying to convert 32-bit multipage TIFF image to several single TIFF images.
Command from here
convert -depth 32 temp.tif single%d.tif
convert: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/ti
ff.c/TIFFErrors/565.
convert: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/ti
ff.c/TIFFErrors/565.
convert: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/ti
ff.c/TIFFErrors/565.
convert: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/ti
ff.c/TIFFErrors/565.
convert: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/ti
ff.c/TIFFErrors/565.
convert: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory'
# warning/tiff.c/TIFFWarnings/905.
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/ti
ff.c/TIFFErrors/565.
Seems it can't work with 32-bit images by default convert: Sorry, can not handle images with 32-bit samples.
convert -version
Version: ImageMagick 7.0.2-6 Q16 x64 2016-07-30 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 Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pa
ngocairo png ps rsvg tiff webp xml zlib
Is there any way to do it with ImageMagick?

Mmmm, I have tried Q16 and Q32, HDRI and Non-HDRI versions of ImageMagick with most combinations of most of these options:
-define quantum:format=floating-point
-depth 32
-define tiff:ignore-tags=42113,34737,34736
-define quantum:format=signed
and I can't get anywhere either!
I did have some success, I think with vips which is a fairly light-weight, easily installed package but it kind of depends what you want to do with the data afterwards:
Either you could convert each "page" straight from TIF to 32-bit PNG with this:
vips im_vips2png temp.tif:1 1.png
vips im_vips2png temp.tif:2 2.png
Or, you could go the long way round via PPM format:
# Convert first "page" in TIF to vips format
vips im_tiff2vips temp.tif:1 1.v
# Convert second "page" in TIF to vips format
vips im_tiff2vips temp.tif:2 2.v
... and so on for all 5 pages.
Then I can convert those to float PPMs with vips
vips ppmsave 1.v 1.ppm
vips ppmsave 2.v 2.ppm
And now ImageMagick can process the PPM files:
convert 1.ppm a.png
It kind of depends what you want to do next...

The tiff format is highly extendable, and I would suggest finding/researching the proprietary software used to generate the images.
Following Mark's fantastic answer, I was able to research the following...
Private Tiff Tags
GeoTIFF
0x830e - ModelPixelScaleTag
0x8482 - ModelTiepointTag
0x87af - GeoKeyDirectoryTag
0x87b0 - GeoDoubleParamsTag
0x87b1 - GeoAsciiParamsTag
GDAL library
0xa481 - GDAL_NODATA
TIFF Errors
convert: Sorry, can not handle images with 32-bit samples. `temp.tif' # error/tiff.c/TIFFErrors/564
This message comes from libtiff library that was linked to by ImageMagick. It simply doesn't support TIFFTAG_BITSPERSAMPLE of 32-bit per sample. Here's a code-snippet of TIFFRGBAImageBegin method used by the tiff library.
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
switch (img->bitspersample) {
case 1: case 2: case 4:
case 8: case 16:
break;
default:
sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
img->bitspersample);
return (0);
}
Alternative tiffsplit
If the task is just to spite the layers into isolated images, perhaps the tiffsplit will work...
tiffsplit temp.tif single_
... which will generate single_aaa.tif, single_aab.tif, & etc.
However the last layer of the image appears corrupt :(

Related

"gs: symbol lookup error: /lib64/libgs.so.9: undefined symbol: FT_Property_Set" Error when converting .ai file to .png with ghostscript 9.25

I'm using ImageMagick with ghostscript 9.25 to convert images. When I try to convert .ai file to .png with image magic I'm getting the below error in command line
My command ./convert /home/sample_ai_file2.ai /home/ai_out.png
gs: /opt/software/alfresco-one/common/lib/libtiff.so.5: no version information available (required by /lib64/libgs.so.9)
gs: /opt/software/alfresco-one/common/lib/libjpeg.so.62: no version information available (required by /lib64/libgs.so.9)
gs: symbol lookup error: /lib64/libgs.so.9: undefined symbol: FT_Property_Set
.convert.bin: NoImagesForWrite '-write' '/home/sshtest/ai_out.png' at CLI arg 2 # error/operation.c/CLINoImageOperator/4769.
.convert.bin: NoImageForProperty "%w" # warning/property.c/GetMagickPropertyLetter/2561.
.convert.bin: UnknownImageProperty "%w" # warning/property.c/InterpretImageProperties/3499.
.convert.bin: NoImageForProperty "%h" # warning/property.c/GetMagickPropertyLetter/2449.
.convert.bin: UnknownImageProperty "%h" # warning/property.c/InterpretImageProperties/3499.
.convert.bin: NoImageForProperty "%m" # warning/property.c/GetMagickPropertyLetter/2480.
.convert.bin: UnknownImageProperty "%m" # warning/property.c/InterpretImageProperties/3499.
Does any one know the reason for this error ? I can convert all the other image types without any issue.
I was able to find the cause for the above mentioned issue. The error was due to having two versions of GS installed in my system.
When I install ImageMagick, GS 8.64 is also automatically installed by default, then I have again manually installed GS 9.25.
Removing the GS 9.25 resolved my issue.

I can't convert image to monochrome bitmap with imagemagick

I'm trying to transform an image to monochrome bmp and its not working.
I tried writing:
magick.exe convert c:\users\asus\desktop\image.jpg -monochrome c:\image.bmp
and I got the following error
convert: UnableToOpenConfigureFile delegates.xml' # warning/configure.c/GetConfigureOptions/702.
convert: UnableToOpenModuleFile 'C:\Program Files\ImageMagick-7.0.10-Q16\modules\coders\IM_MOD_RL_JPEG_.dll': No such file or directory # warning/module.c/GetMagickModulePath/675.
convert: NoDecodeDelegateForThisImageFormatJPEG' # error/constitute.c/ReadImage/562.
convert: NoImagesDefined `c:\image.bmp' # error/convert.c/ConvertImageCommand/3282.
What am I doing wrong?

ImageMagick:: Throwing DLL error --> IM_MOD_RL_PNG_.dll': The specified module could not be found

I am trying to run a simple comparison ROBOT FrameWork Script. Here is the script..
*** Settings ***
Library String
Library OperatingSystem
*** Variables ***
${IMAGE_COMPARATOR_COMMAND} D:\\"Program Files"\\ImageMagick-7.0.7-Q8\\convert __REFERENCE__ __TEST__ -metric RMSE -compare -format "%[distortion]" info:
*** Test Cases ***
Image Comparison Ok
Compare Images D:/Project/Lg/imageCompare/CollectorCreation_IE.png D:/Project/Lg/imageCompare/CollectorCreation_Chrome.png # 0.1
#Image Comparison NOk
# Compare Images D:/Project/Lg/imageCompare/CollectorCreation_IE.png D:/Project/Lg/imageCompare/CollectorCreation_Chrome.png 0.1
*** Keywords ***
Compare Images
[Arguments] ${Reference_Image_Path} ${Test_Image_Path} ${Allowed_Threshold}
${TEMP}= Replace String ${IMAGE_COMPARATOR_COMMAND} __REFERENCE__ ${Reference_Image_Path}
log ${TEMP}
${COMMAND}= Replace String ${TEMP} __TEST__ ${Test_Image_Path}
log ${COMMAND}
Log Executing: ${COMMAND}
${RC} ${OUTPUT}= Run And Return Rc And Output ${COMMAND}
Log Return Code: ${RC}
Log Return Output: ${OUTPUT}
${RESULT} Evaluate ${OUTPUT} < ${Allowed_Threshold}
Should be True ${RESULT}
but I ran into issue with dll's. Not sure what is the issue.
Return Output: convert: unable to load module 'd:\Program Files\ImageMagick-7.0.7-Q8\modules\coders\IM_MOD_RL_PNG_.dll': The specified module could not be found.
# error/module.c/OpenModule/1275.
convert: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/509.
convert: unable to load module 'd:\Program Files\ImageMagick-7.0.7-Q8\modules\coders\IM_MOD_RL_PNG_.dll': The specified module could not be found.
# error/module.c/OpenModule/1275.
convert: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/509.
convert: unable to open image '#': No such file or directory # error/blob.c/OpenBlob/3323.
convert: unable to open image '#': No such file or directory # error/blob.c/OpenBlob/3323.
convert: no decode delegate for this image format `' # error/constitute.c/ReadImage/509.
convert: no images defined `info:' # error/convert.c/ConvertImageCommand/3275.
I could see this dll in the given location bt program is not able to pick.
I am using Windows 7 64 bit machine and i installed "ImageMagick-7.0.7-14-Q16-x64-dll.exe" and got above issue and tried with "ImageMagick-7.0.7-14-Q8-x64-dll.exe" (i am picking from here) same result.
Can some one help me out with issue. I am guessing it would be issue with the installed version.
C:\Users\bbanduch>magick -version
Version: ImageMagick 7.0.7-14 Q8 x64 2017-12-06 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 Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype gslib jng jp2 jpeg lcms lqr openexr pangocairo png ps raw rsvg tiff webp xml zlib

When I try to do a batch magick convert -flatten command on a directory, it fails

I'm, trying to flatten a whole directory of .png images to have a white background.
The following command works on a single file:
magick convert -flatten "c:\Users\LibrarySurface2\OneDrive\Pictures\2016-08-09 archive of coworking space feedback\20151214 115702.png" "c:\Users\LibrarySurface2\OneDrive\Pictures\2016-08-09 archive of coworking space feedback\20151214 115702-white.png"
...however when I try to run it against the whole directory (1300 or so images) using the following command:
magick convert -flatten *.png *-w.png
It fails out with a bunch of these, and then stops running because of "too many exceptions" any thoughts on what could be causing this?
convert: Expected 3949 bytes; found 2684 bytes .\20160426 114948.png' # warning/png.c/MagickPNGWarningHandler/1683.
convert: Read Exception.\20160426 114948.png' # error/png.c/MagickPNGErrorHandler/1650.
convert: corrupt image .\20160426 114948.png' # error/png.c/ReadPNGImage/4029.
convert: Expected 4585 bytes; found 929 bytes.\20160429 145040.png' # warning/png.c/MagickPNGWarningHandler/1683.
convert: Read Exception .\20160429 145040.png' # error/png.c/MagickPNGErrorHandler/1650.
convert: corrupt image.\20160429 145040.png' # error/png.c/ReadPNGImage/4029.
convert: Expected 8192 bytes; found 8037 bytes .\20160504 165938.png' # warning/png.c/MagickPNGWarningHandler/1683.
convert: Read Exception.\20160504 165938.png' # error/png.c/MagickPNGErrorHandler/1650.
convert: corrupt image `.\20160504 165938.png' # error/png.c/ReadPNGImage/4029.
Make a backup first, then use mogrify instead:
mogrify -flatten *.png
Explanation: In general, use the convert command when you want one output file and mogrify when you want multiple output files.

convert.exe: invalid argument for option `-crop':

convert.exe: invalid argument for option `-crop': '230x53+64+157'-auto-orient # error/convert.c/ConvertImageCommand/1154. [paperclip] An error was received while processing: #
I have referred:
http://railscasts.com/episodes/182-cropping-images
to crop my image.

Resources