Add white border to existing large image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mail2vguna
Posts: 20
Joined: 2015-06-04T07:52:46-07:00
Authentication code: 6789

Add white border to existing large image

Post by mail2vguna »

Hi

I am using IM version ImageMagick-6.8.5-3 on windows.

source image test.tif (1920 dpi, width - 51840 , height - 115200, bit depth - 1, image size - 711.MB)

set MAGICK_TEMPORARY_PATH=d:\temp - 50 GB available in d: drive

i am trying to add border like 8000 pixels to left, right , top and bottom to test,tif image.

i am using the following code to add the border

convert.exe -border 8000x8000 test.tif output.tif

i am getting error while using below code
TIFFWriteDirectoryTagData: IO error writing tag data.
convert.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/824.
convert.exe: unable to extend cache `test.tif': No space left on device @ error/cache.c/OpenPixelCache/3753.
convert.exe: IO error writing tag data. `TIFFWriteDirectoryTagData' @ error/tiff.c/TIFFErrors/562.

But its taking long time to add border. Still need more space in d:\ drive? what is the approximate free space need in d: drive? How can i make it fast?

Kindly do the needful. Many Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Add white border to existing large image

Post by snibgo »

IM v6, assuming Q16 non-HDRI, needs 8 bytes per pixel to read the image, and the same amount to create and populate the new image with the border.

51840 * 115200 * 8 = 48 GB. So you don't have enough memory or disk space.
snibgo's IM pages: im.snibgo.com
mail2vguna
Posts: 20
Joined: 2015-06-04T07:52:46-07:00
Authentication code: 6789

Re: Add white border to existing large image

Post by mail2vguna »

Hi
Thanks for quick response.
So what is the solution for that? Should i use latest IM version? 500 GB free space.
How can i make it fast? it is possible to do the less than 2 minutes (add border).

Many thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Add white border to existing large image

Post by snibgo »

How much free space do you have, 50GB or 500GB? 50GB isn't enough.

IM Q8 will use half the memory.
snibgo's IM pages: im.snibgo.com
mail2vguna
Posts: 20
Joined: 2015-06-04T07:52:46-07:00
Authentication code: 6789

Re: Add white border to existing large image

Post by mail2vguna »

Hi

My external hard drive has 500GB free space, shall i use that?

Approximately how much time it will take to complete the process(add 8000 pixel in each side to large image (based on above input image)).

Many Thanks.
mail2vguna
Posts: 20
Joined: 2015-06-04T07:52:46-07:00
Authentication code: 6789

Re: Add white border to existing large image

Post by mail2vguna »

Hi

I have downloaded ImageMagick-7.0.8-Q8 64 bit for windows.
set MAGICK_TEMPORARY_PATH=d:\temp
magick.exe -border 8000x8000 d:\1920.tif output.tif

magick.exe: no images found for operation `-border' at CLI arg 1 @ error/operation.c/CLIOption/5262.

What is the operation in 7.0.8 version instead of border?

Looking forward your reply.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Add white border to existing large image

Post by fmw42 »

Read the input first, then add the border. Why such a large border? You might also want to specify the bordercolor.

Code: Select all

magick.exe d:\1920.tif -border 8000x8000  output.tif
mail2vguna
Posts: 20
Joined: 2015-06-04T07:52:46-07:00
Authentication code: 6789

Re: Add white border to existing large image

Post by mail2vguna »

Hi

Thanks for your response

Tried following script.

magick.exe d:\1920.tif -border 8000x8000 output.tif

magick.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/995.
magick.exe: memory allocation failed `d:\1920.tif' @ error/tiff.c/ReadTIFFImage/1800.
magick.exe: no images found for operation `-border' at CLI arg 2 @ error/operation.c/CLIOption/5262.

in d: drive i have 50GB free space.
mail2vguna
Posts: 20
Joined: 2015-06-04T07:52:46-07:00
Authentication code: 6789

Re: Add white border to existing large image

Post by mail2vguna »

HI

Tried with 355GB free space external hard drive using following script

set MAGICK_TEMPORARY_PATH=e:\im - 355GB free space in e: drive

D:\Program Files\ImageMagick-7.0.8-Q8>magick.exe d:\1920.tif -border 8000x8000 output.tif
magick.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/995.
magick.exe: memory allocation failed `d:\1920.tif' @ error/tiff.c/ReadTIFFImage/1800.
magick.exe: no images found for operation `-border' at CLI arg 2 @ error/operation.c/CLIOption/5262.

Any solution to fix the issue ?

Looking forward your reply. Anything wrong with my IM script?

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

Re: Add white border to existing large image

Post by fmw42 »

You may be running out of RAM. Also it appears you did not rearrange your command as I suggested. IM 7 requires precise order. You must read the input image before adding a border.

Code: Select all

magick.exe -quiet d:\1920.tif -border 8000x8000  output.tif
Note that warnings do not hurt. They imply that your TIF file has meta tags that IM does not understand. But if you only have warnings and no errors then your output will be created. You can avoid the warnings by adding -quiet to your command as above.

You have two errors and one warning. The first error

memory allocation failed `d:\1920.tif'

Implies either you did not rearrange the command line or you do not have enough RAM.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Add white border to existing large image

Post by snibgo »

How much physical memory do you have? Perhaps reading the file takes all your memory, and there is none left for the border operation. Try "-limit memory 1GB -limit map 1GB" at the start of the command.
snibgo's IM pages: im.snibgo.com
Post Reply