Not responding when Convert Jpg(800Kb) to Tiff

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
sireeshala
Posts: 38
Joined: 2013-09-27T04:00:05-07:00
Authentication code: 6789

Not responding when Convert Jpg(800Kb) to Tiff

Post by sireeshala »

In my application i am using the image magick dlls to convert a Jpeg image to tiff.
The settings i have done to implement the conversion are "resize 7968x10968! density 300x300 quality 50 ".
for the "image.write" function call from dll there is no response . and the tiff image is not created for infinite time.
But when i am using the same settings with convert.exe directly from cmd prompt i am able to get the converted image.

Can any one help to fix this issue.

Thanks in Advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by fmw42 »

Please identify your IM version, platform and exact full command.
"resize 7968x10968! density 300x300 quality 50 "
Note that all IM commands start with a minus sign

"-resize 7968x10968! -density 300x300 -quality 50 "

Also I am not sure -quality applies to an output Tiff unless your use jpg compression
sireeshala
Posts: 38
Joined: 2013-09-27T04:00:05-07:00
Authentication code: 6789

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by sireeshala »

Thanks for reply.

Version 6.8.7-10 and on Windows 7
the complete command line is "convert.exe in.jpg -resize 7968x10968! -density 300x300 -quality 50 -compress Group4 -type Bilevel Out.tiff"
After this command for infinite time out.tiff is not created.

This is the same case with lib files also .I am not able to get the result when i am setting the Object parameters to these values for my image.

Note :How to attach a sample Jpeg to this post?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by fmw42 »

you may need to escape the ! as ^! or put the argument in double quotes.

To post an image, you need to upload it to some free image hosting web site (such as dropbox), and then post a link here back to the image.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by snibgo »

sireeshala wrote:for the "image.write" function call from dll there is no response . and the tiff image is not created for infinite time.
You need to provide the exact code you are using, and the input file that causes the problem.

You may have run out of memory.
snibgo's IM pages: im.snibgo.com
sireeshala
Posts: 38
Joined: 2013-09-27T04:00:05-07:00
Authentication code: 6789

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by sireeshala »

Thanks for your quick response .

I have tried as you suggested.

convert.exe C:\Users\sireesha.lachhireddi\Desktop\imagemagic\rescale.jpg -resize 7968x10968^! -density 300x300 -quality 50 -compress Group4 -type Bilevel C:\Users\sireesha.lachhireddi\Desktop\imagemagic\rescale.tiff

And even like

convert.exe C:\Users\sireesha.lachhireddi\Desktop\imagemagic\rescale.jpg -resize 7968x10968 -density 300x300 -quality 50 -compress Group4 -type Bilevel C:\Users\sireesha.lachhireddi\Desktop\imagemagic\rescale.tiff

There is no change in the result .

The code i have used is

Code: Select all

string sResultSinglePage( "rescale.jpg");
Geometry gNewDensity(300,300);
Image image;
image.read( sResultSinglePage.c_str() );
image.resize("7968x10968");
image.density(gNewDensity);
image.quality(g_nJpegQuality);
image.magick("TIFF");
image.compressType(Group4Compression);
image.type(BilevelType);
image.write("rescale.tiff");
yes we may go out of memory but it should throw an exception or at least an error message.but there is no response from the function call.

I have uploaded my sample image in drop box at following link.
https://www.dropbox.com/s/3g3baikbnvomd5k/rescale.jpg
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by snibgo »

Your command works on my Windows 7 computer, using 1.2 GB of memory, producing an entirely black result. The image is far better by also using "-contrast-stretch 5x80%".

Sorry, I can't advise on your code.
snibgo's IM pages: im.snibgo.com
sireeshala
Posts: 38
Joined: 2013-09-27T04:00:05-07:00
Authentication code: 6789

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by sireeshala »

Is this command working ..?. are you working on 64 bit or 32 bit system?

Mine is windows 7 sp1 64 bit system with ram 8 GB.

I tried this on windows 2008 r2 with Ram 2GB i got an error message "no space exception".

https://www.dropbox.com/s/98455ufaj2bpz ... ws7_64.JPG

https://www.dropbox.com/s/zioncenmivxol ... 2K8_64.png
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Not responding when Convert Jpg(800Kb) to Tiff

Post by snibgo »

I'm on Windows 7 with 4 GB RAM, 64 bit, IM v6.8.6-8.

Code: Select all

convert rescale.jpg -resize 7968x10968! -density 300x300 -quality 50 -compress Group4 -type Bilevel r2.tif
This completed in 1 minute 12 seconds, using about 1.2 GB of RAM. The result is entirely black.

As the result is black, changing the contrast at the end will have no effect. That has to be placed earlier in the process, eg:

Code: Select all

convert rescale.jpg -contrast-stretch 5x80% -resize 7968x10968! -density 300x300 -quality 50 -compress Group4 -type Bilevel r2.tif
The result is entirely legible.

I think Group4 compression is bilevel, so "-type bilevel" is superfluous. I don't think "-quality" is relevant for Group4 compression. So the command is simply:

Code: Select all

convert rescale.jpg -contrast-stretch 5x80% -resize 7968x10968! -density 300x300 -compress Group4 r3.tif
I don't know what you are trying to do. If you remove the resize, it runs much faster (6 seconds) and uses far less memory.
snibgo's IM pages: im.snibgo.com
Post Reply