unable to convert to tif using stdout to BufferedImage
Posted: 2011-02-11T11:17:11-07:00
I'm trying to convert a png to a tif file in memory (without writing the file to the file system) and am getting the "unable to write blob" error. Thinking that it has something to do with not deleting tmp files.
Windows 7 Enterprise
Version ImageMagick-6.6.7-Q16
You can duplicate the error message at the command line in image magick by trying to convert the .png file to a tif in stdout. (Probably not a great test, but if you try doing the same thing as a .jpg, it streams the output to the screen)
02/10/2011 02:58 PM 3,711 ScanCompressedThumbNailImage.png
C:\EVO\E360\E360Batch\src\test\resources\images>convert ScanCompressedFullPageImage.png "tif:-"
Magick: unable to write blob `-': Not enough space @ error/blob.c/ImageToFile/1662.
I'm using im4java and this is where I initially received the error message. Here is my java code: Note if I try writing the image to the file system by uncommenting the code below, the file is written to the os with no problems.
Anyone seen this behavior or have a work around?
Windows 7 Enterprise
Version ImageMagick-6.6.7-Q16
You can duplicate the error message at the command line in image magick by trying to convert the .png file to a tif in stdout. (Probably not a great test, but if you try doing the same thing as a .jpg, it streams the output to the screen)
02/10/2011 02:58 PM 3,711 ScanCompressedThumbNailImage.png
C:\EVO\E360\E360Batch\src\test\resources\images>convert ScanCompressedFullPageImage.png "tif:-"
Magick: unable to write blob `-': Not enough space @ error/blob.c/ImageToFile/1662.
I'm using im4java and this is where I initially received the error message. Here is my java code: Note if I try writing the image to the file system by uncommenting the code below, the file is written to the os with no problems.
Code: Select all
public byte[] convertPngToTifImage(byte[] fullPagePNGImage) throws IOException, InterruptedException, IM4JavaException {
File output = new File("src/test/resources/images/ScanCompressedFullPageImage.png");
IMOperation op = new IMOperation();
op.addImage(); //place holder for input file
// op.addImage(output.getAbsoluteFile().toString()); // used to verify that a file can be written to the file system.
op.addImage("tif:-"); // output: stdout
ConvertCmd convert = new ConvertCmd();
Stream2BufferedImage s2b = new Stream2BufferedImage();
convert.setOutputConsumer(s2b);
// run command and extract BufferedImage from OutputConsumer
convert.run(op, fullPagePNGImage );
BufferedImage img = s2b.getImage();
return img;