Solved

ImageMajick convert

Posted on 2009-07-03
21
1,537 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
ID: 24782949
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
ID: 24783410
Please compare 'ulimit -a' on both machines.
Any differences regarding data/memory/stack?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 24784315
I use the tiff tools for tiff to pdf. The tool I use is imaginitively called tiff2pdf.

0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:blots
ID: 24785274
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:Richard Quadling
ID: 24785378
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:Richard Quadling
ID: 24785385
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:Richard Quadling
ID: 24785401
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
ID: 24785412
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:Richard Quadling
ID: 24785416
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
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 24785456
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
ID: 24785661
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
ID: 24785762
ulimit is OK.
Do you have sufficient privileges to write the output file?
0
 

Author Comment

by:blots
ID: 24785792
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
ID: 24785875
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:
Richard Quadling earned 500 total points
ID: 24785916
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:Richard Quadling
ID: 24785949
Re-install the package?
0
 

Author Closing Comment

by:blots
ID: 31599611
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:Richard Quadling
ID: 24823313
Glad to have helped.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

809 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