Imagemagick getting stuck while converting tif file.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

Note the conversion to .tif never crash. It always crashes on the multiple page conversion to pdf.
i.e.
magick 481藉我賜恩褔*.tif -units PixelsPerInch -page Letter -density 72 481藉我賜恩褔.pdf

Thank you for looking into this snibgo! Really appreciated!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick getting stuck while converting tif file.

Post by fmw42 »

PhotoCat wrote:oh... how do u check if the libtif is up-to-date? tks!
convert -list format

should tell you the version of libtif, e.g

TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.6)


My guess is that your use of wildcards is either grabbing too many images for your memory or that you are running out of temp space in your /tmp directory or whatever is the equivalent on Windows.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Imagemagick getting stuck while converting tif file.

Post by snibgo »

I don't know what the problem is. I suggest you try:

(1) Split into separate commands, without "&&":

Code: Select all

magick 558.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481藉我賜恩褔001.tif

echo multiplepage

magick 559.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481藉我賜恩褔002.tif

magick 481藉我賜恩褔*.tif -units PixelsPerInch -page Letter -density 72 481藉我賜恩褔.pdf
(2) Use names with only ASCII characters:

Code: Select all

magick 558.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481_A_001.tif

echo multiplepage

magick 559.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481_B002.tif

dir 481_*.tif

magick 481_*.tif -units PixelsPerInch -page Letter -density 72 481_out.pdf
I include "dir 481_*.tif" to check for any other files named like that.
snibgo's IM pages: im.snibgo.com
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

1) tried this:

magick 558.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481藉我賜恩褔001.tif
echo multiplepage
magick 559.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481藉我賜恩褔002.tif

magick 481藉我賜恩褔*.tif -units PixelsPerInch -page Letter -density 72 481藉我賜恩褔.pdf

results: the last line crashed again. (same as before)

2) changed to this:

magick 558.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481blessings_come_from_God001.tif
echo multiplepage
magick 559.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481blessings_come_from_God002.tif

magick 481blessings_come_from_God*.tif -units PixelsPerInch -page Letter -density 72 481blessings_come_from_God.pdf

results: wow! it worked! Not only did it work but the computation speed is much much faster for all commands, not just the last command!

Thank you so much snibgo for identifying the problem! What can I do to keep the chinese unicode names though? tks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Imagemagick getting stuck while converting tif file.

Post by snibgo »

Excellent. You have a workaround. You can rename files before IM sees them, and rename them back afterwards.

There may be a bug in the way IM handles wildcards, when using UTF-8. I almost never use non-ASCII characters, so I don't encounter the problem.

I've reported this as a possible bug: viewtopic.php?f=3&t=30248
snibgo's IM pages: im.snibgo.com
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

Thank you so much snibgo for your help. Indeed it would not be too difficult to incorporate the renaming process in the scripts as a workaround.
Thanks you everyone once again and thank you for the amazing magick tool!
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

More info for the developers:

I have found out that this would work:
---------------------
magick 558.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481blessings_come_from_God001.tif
echo multiplepage
magick 559.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481blessings_come_from_God002.tif

magick 481blessings_come_from_God*.tif -units PixelsPerInch -page Letter -density 72 481blessings_come_from_God.pdf
---------------------
but the following won't:
---------------------
magick 558.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481blessings_come_from_God001.tif
echo multiplepage
magick 559.jpg -colorspace Gray -type Grayscale -depth 1 -compress group4 481blessings_come_from_God002.tif

magick 481blessings_come_from_God*.tif -units PixelsPerInch -page Letter -density 72 481藉我賜恩褔.pdf
----------------------

So not only does magick crash while handling wild cards with unicode, but it also fails if the output filename is unicode. (as least in Chinese)
Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick getting stuck while converting tif file.

Post by fmw42 »

Are you sure your output name has proper UTF-8 characters? Some foreign characters look fine but are not proper UTF-8
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

Not 100% sure as I don't know how to test it for true UTF-8 compliance but I can rename a folder using the same characters.
Windows 7 & 10 seem to take it ok. I can also see the same characters on DOS prompt. Put it in MSWord and it prints well.
It also seems to display well in Notepad++ which has a good reputation of handling unicode characters. Also displays well in plain Notepad.
The characters also display well on google drive and on android phones and tablets so the chance is high that the characters are ok.

I know what u mean for some old big5 Chinese encoding etc, that requires some special s/w to view them properly. Not in my case here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick getting stuck while converting tif file.

Post by fmw42 »

I do not know if Notepad is UTF-8 compatible. I would recommend you use Wordpad. Or some UTF-8 compatible text editor.

But to test, try putting your characters in a label: command and see if IM prints them fine in the output image.

Code: Select all

convert -background white -fill black -pointsize 36 label:"your_characters_here" result.gif
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

Thank you Fred for the pointer. Appreciated it!

ok, used this command:

magick -background white -fill black -pointsize 36 label:"481藉我賜恩褔" result.gif

and the gif file reads 481?????

I guess this is not a good sign eh?

tried some other text that passed: 403數算主恩

It came out 403???? :shock: :shock: :shock:

Tried many other characters I have used and it all turned out "?????" in the gif file again.

But they had all worked! Mmm...
PhotoCat
Posts: 20
Joined: 2016-07-08T08:43:07-07:00
Authentication code: 1151

Re: Imagemagick getting stuck while converting tif file.

Post by PhotoCat »

btw, I think I have got the TIFF library ok: (tks Fred once again!)

magick -list format | grep TIFF

TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.6)
TIFF64* TIFF rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.6)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick getting stuck while converting tif file.

Post by fmw42 »

You need to create your characters in a UTF-8 compatible text editor using a UTF-8 compliant font. Check in Wordpad to see if it is in UTF-8 compatible mode. Then copy and paste those characters from your text editor to your CMD window in the label: field.
Post Reply