views:

245

answers:

3

A legacy backend requires the email body with a .tif document, no tif and it fails. So i need to generate a blank .tif, is there a fast way to do this with ghostscript?


edit: make once in project installation use when i need it.

A: 

Couldn't you make your blank .tif file once and then attach the same file every time it is needed?

fryguybob
It is better to do this, but I still would like to generate it, as I would prefer not to create it then distribute it in the package.
Setori
The definition of .tif isn't going to change so the once generated file could be thought of as just a set of bytes that is the magic word for "blank .tif". You don't have to store that in the file system, it could be as a resource or directly in code. Isn't that better than an extra dependency?
fryguybob
A: 

Might be something here: Re: [R] Making TIFF images with rtiff

boost
+3  A: 

The following line will produce a 1 pixel Tiff file (340 bytes). That's the smallest Tiff file I could get.

gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffpack -g1x1 -sOutputFile=small.tif -c newpath 0 0 moveto 1 1 lineto closepath stroke showpage quit

Actually, you can even reduce the command to:

gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffpack -g1x1 -sOutputFile=small.tif -c showpage quit

without size gain, alas.

PhiLho
Even shorter: `gswin32c -o small.tif -g1x1 -sDEVICE=tiffpack -c showpage quit`. Result is 302 bytes.
pipitas