Hi all,
I am new on this Board and are trying to figure out if ImageMagick can be a solution for me.
I hope I can get an idea if my target can be reached:
Using the actual version i want to read a pdf, ript it to a fixed resolution, save it in separations (separate color per file) and cut the output tiff file in 5 different smaller tiff files (vertical equal divided). No pixel are allowed to get lost at the cutting edge.
The reason is that the software which use the tiff files later cannot handle too large files.
it would be amazing if anyone could give me some help here!
Thanks, Alex
convert pdf to tiff and save in several files
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert pdf to tiff and save in several files
Something like this:
Code: Select all
magick -density 125 in.pdf -crop 5x1@ -separate out.tiff
snibgo's IM pages: im.snibgo.com
Re: convert pdf to tiff and save in several files
Sounds good and i tried it.
How can I create several different files and not one output file with 5 pages?
How can I create several different files and not one output file with 5 pages?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert pdf to tiff and save in several files
Insert "+adjoin" before the output filename.
snibgo's IM pages: im.snibgo.com
Re: convert pdf to tiff and save in several files
Thanks for your suggestion, it works.
Actually I use: magick IN.tiff -crop 5x1@ +adjoin OUT.tiff
I tried the software also with different input files. For a test file with 62599x43406 pixels the image it works fine and I get 5 pieces of the image.
In a second file with a resolution 131246x93334 pixel the image crop seems to fail. After the software created 2 part images, it stops working. If I set the number of image parts to 10, it will create 5 images and stop.
Currently I use a pc with 16 GB RAM, but so far the magick.exe seems never to exceed 2.6GB in task manager.
How to process such files?
Thanks, Alex
Actually I use: magick IN.tiff -crop 5x1@ +adjoin OUT.tiff
I tried the software also with different input files. For a test file with 62599x43406 pixels the image it works fine and I get 5 pieces of the image.
In a second file with a resolution 131246x93334 pixel the image crop seems to fail. After the software created 2 part images, it stops working. If I set the number of image parts to 10, it will create 5 images and stop.
Currently I use a pc with 16 GB RAM, but so far the magick.exe seems never to exceed 2.6GB in task manager.
How to process such files?
Thanks, Alex
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert pdf to tiff and save in several files
Those are large images, eg 131246x93334 is 12 G pixels. At 6 bytes/pixel, this needs 72 GB memory for just the input image.AlexZ wrote:Currently I use a pc with 16 GB RAM, but so far the magick.exe seems never to exceed 2.6GB in task manager.
Check this:
Code: Select all
f:\web\im>%IMG7%magick -list resource
Resource limits:
Width: 107.374MP
Height: 107.374MP
List length: -1
Area: 6.40681GP
Memory: 2.9834GiB
Map: 5.9668GiB
Disk: unlimited
File: 1536
Thread: 8
Throttle: 0
Time: unlimited
This might cure the crashing problem. However, you don't have enough memory. You can limit "memory" and "map" at the command line to say 1 MB to force IM to use disk for the pixel caches, preventing IM from trying and failing to allocate memory, and this may improve performance.
snibgo's IM pages: im.snibgo.com
Re: convert pdf to tiff and save in several files
Actually I'm using grayscale images, means 1 byte/pixel, but however I see that there will be large images, which I cannot process maybe. I modified the command line again to
magick.exe -limit memory 8Gib -limit map 8GiB -limit area 8GiB "IN.tiff" -unsharp 1x1+2 -crop 14x1@ +adjoin "OUT.tiff"
which is working good for most images. Sometimes it happens (for big pictures) that the image magick seems to run and run without finishing, for testing I wait about 30 minutes. The CPU load and memory usage is very constant then. I tested several files, with several configurations, so I assume that this happens because of memory limitation during the unsharpening process. I know that I can set a maximum time limit with -limit time command, but is there any other way to get an error message and abort the process earlier, if the processing is not possible?
magick.exe -limit memory 8Gib -limit map 8GiB -limit area 8GiB "IN.tiff" -unsharp 1x1+2 -crop 14x1@ +adjoin "OUT.tiff"
which is working good for most images. Sometimes it happens (for big pictures) that the image magick seems to run and run without finishing, for testing I wait about 30 minutes. The CPU load and memory usage is very constant then. I tested several files, with several configurations, so I assume that this happens because of memory limitation during the unsharpening process. I know that I can set a maximum time limit with -limit time command, but is there any other way to get an error message and abort the process earlier, if the processing is not possible?