Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1558
  • Last Modified:

ImageMajick convert

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
blots
Asked:
blots
  • 9
  • 6
  • 2
  • +1
1 Solution
 
ozoCommented:
Are there any other differences between the production and dev servers?
can you post the test.tif file?
0
 
woolmilkporcCommented:
Please compare 'ulimit -a' on both machines.
Any differences regarding data/memory/stack?
0
 
Richard QuadlingSenior Software DeverloperCommented:
I use the tiff tools for tiff to pdf. The tool I use is imaginitively called tiff2pdf.

0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
blotsAuthor Commented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
blotsAuthor Commented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
blotsAuthor Commented:
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
 
woolmilkporcCommented:
ulimit is OK.
Do you have sufficient privileges to write the output file?
0
 
blotsAuthor Commented:
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
 
blotsAuthor Commented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
Re-install the package?
0
 
blotsAuthor Commented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
Glad to have helped.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now