Solved

ImageMajick convert

Posted on 2009-07-03
21
1,532 Views
Last Modified: 2013-11-08
I have two similar servers with centos 5. One is a development server one production. both use standard packages manged with yum. I would like to continue using standard packages

the convert command is behaving behaving differently between the servers. the production server gives me a memory allocation error while converting monochrome tif to pdf.

the dev server the one that works has 1 gig of memory
the production server has 4 gig

convert test.tif test.pdf
convert: Memory allocation failed `test.pdf'.

the command works with smaller images. the images I want to convert are monochrome scans of documents. group4 compression

I did try passing some options to convert  which seemed to make not difference, also it is not unnecessary on the dev system. the dev system does create a monochrome compressed pdf without passing any options

 convert test.tif -monochrome -compress Group4 -quality 100 -units PixelsPerInch -density 600 test2.pdf

Am I missing some package that conversion to pdf uses?
0
Comment
Question by:blots
  • 9
  • 6
  • 2
  • +1
21 Comments
 
LVL 84

Expert Comment

by:ozo
Comment Utility
Are there any other differences between the production and dev servers?
can you post the test.tif file?
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
Please compare 'ulimit -a' on both machines.
Any differences regarding data/memory/stack?
0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
I use the tiff tools for tiff to pdf. The tool I use is imaginitively called tiff2pdf.

0
 

Author Comment

by:blots
Comment Utility
Here an example of a file that will not convert to pdf. with convert:
$ convert ./test.tif ./test.pdf
convert: Memory allocation failed `./test.pdf'.

http://train.repin.net/test.tif
0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
The TiffInfo for that file is ...

TIFF Directory at offset 0x12c4 (4804)
  Image Width: 2528 Image Length: 3280
  Resolution: 118.292, 118.292 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 4
  Photometric Interpretation: min-is-white
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 3280
  Planar Configuration: single image plane
  DocumentName: /var/crev/convert/sp/20090601ramsey1/20090601ramsey1_82.tif
  Software: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html


This is a tiff from our fax server

TIFF Directory at offset 0x1101a (69658)
  Subfile Type: (0 = 0x0)
  Image Width: 1728 Image Length: 2292
  Resolution: 204, 196 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 4
  Photometric Interpretation: min-is-white
  Samples/Pixel: 1
  Rows/Strip: 2292
  Planar Configuration: single image plane

And after I play with it to add banners ...

TIFF Directory at offset 0x12e12 (77330)
  Image Width: 1728 Image Length: 2492
  Resolution: 204, 196 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 4
  Photometric Interpretation: min-is-white
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 2492
  Planar Configuration: single image plane
  DocumentName: Z:\Faxes\Received\2009\06\01\2009-06-01__05-19__Page-0001__AMXSFC.tif
  Software: ImageMagick 6.4.6 2008-11-25 Q8 http://www.imagemagick.org

I managed to convert my Z:\Faxes\Received\2009\06\01\2009-06-01__05-19__Page-0001__AMXSFC.tif to a PDF.

And here is your test.pdf
test.pdf
0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
I see you are using ImageMagick 6.2.8 Q16 and I'm using ImageMagick 6.4.6 Q8.

Maybe an upgrade would be useful in this instance.
0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
And here is the test2.pdf which was converted using your ...

convert test.tif -monochrome -compress Group4 -quality 100 -units PixelsPerInch -density 600 test2.pdf
test2.pdf
0
 

Author Comment

by:blots
Comment Utility
when I run "ulimit -a" I see a difference in the "pending signals" and "max user processes".

development system:
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 38912
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 38912
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Production System:
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 8120
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 8120
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited


0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
What manipulation are you doing to the tif file? I don't mean the tif -> pdf conversion. Your tif file has been tagged by IMagick. For what reason?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
I'm running on windows, so not exactly sure.

But I'll see if I can get hold of the same version you are using ...
0
 

Author Comment

by:blots
Comment Utility
thanks for you help RQuadling

It is very strange. the cmand you use works fin on the Developmetn server but not on the production server.
Production:
$ convert test.tif -monochrome -compress Group4 -quality 100 -units PixelsPerInch -density 600 test.pdf                        
convert: Memory allocation failed `test.pdf'.


Also tiff2pdf does work on productions server. however at first glance it does not seem to allow you to create a multi page pdf from multiple single page tiff files. This in one thing I am doing with convert on the dev server. I will look into this option more.

As for upgrading ImageMagick. I was hoping to make this all work on a vanilla centos5 server.   centos5 packages include  ImageMagick 6.2.8. The advantage to not upgrading is we can continue to manage the os with standard packages. also, what is really bugging me is that it works on the other sever with the same version.
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
ulimit is OK.
Do you have sufficient privileges to write the output file?
0
 

Author Comment

by:blots
Comment Utility
RQuadling,

I'm not convinced it is an issue with the version. it is working using same version on a  different machine.

The single page tiff images are tagged with imagesMagick because I am converting them from huge multi page tiff files into single page tiff files. I'm doing this because the multi page tiffs are unruly to work with. The files that come to me are sometimes over 20 meg over 500pages containing mixed documents. I convert them to single pages then figure out which pages go with each document. some are single page documents. some are multiple pages. then I hope to create separate  pdfs for each document which are often 2-5 pages long.


 
0
 

Author Comment

by:blots
Comment Utility
woolmilkpor,

I do have permissions correct. I can convert to other formats. Also I get the same memory error while running this as root
0
 
LVL 40

Accepted Solution

by:
RQuadling earned 500 total points
Comment Utility
I would look into tiffsplit and tiff2pdf. Significantly faster the convert and way less memory. Even on windows.

OOI. Are you sure both packages are the same? I'm not a unix person, but having seen the way that options are specified to configure/make/install things, it seems likely a small difference is enough to make things work/not work.

If the 2 machines are physically identical, does it stand to reason that you could use the binary from the working machine?

If so, so if that works. It may be that the build process detected some difference and pushed that into the build process.

0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
Re-install the package?
0
 

Author Closing Comment

by:blots
Comment Utility
Thank you very much for all your help with this Problem. Although I never figured out the specific problem of convert running on one server but not the other, you provided better alternatives. Since I'm not doing any kind of compresion, size, resolution, etc conversion here I don't need convert.

I am now using tiffsplit to separate big multi-page. tiffcp to join them back into smaller docs. then tiff2pdf to create a downloadable doc for the user. This is much faster than convert.

I'll post some code here when I am done with it.
0
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
Glad to have helped.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now