tiff

Convert a bitmap image to an uncompressed tif image in Java

被刻印的时光 ゝ 提交于 2019-12-05 13:05:50
I'm trying to convert a bitmap image into an uncompressed tif file for use with the Tesseract OCR engine. I can use this method to produce a compressed tif file... final BufferedImage bmp = ImageIO.read(new File("input.bmp")); ImageIO.write(bmp, "jpg", new File("output.tif")); This produces an empty tif file when the "jpg" is changed to tif as these files are dealt with in Java Advanced Imaging (JAI). How can I create an uncompressed tif image? Should I decompress the tif image produced from the above code or is there another way to handle the conversion process? Any examples provided would be

How do I check for corrupt TIFF images in C#?

夙愿已清 提交于 2019-12-05 11:17:29
I searched on how to check if a TIFF file is corrupt or not. Most suggests wrapping the Image.FromFile function in a try block. If it throws an OutOfMemoryException, its corrupt. Has anyone used this? Is it effective? Any alternatives? Please check out the freeware called LibTiff .NET. It has the function to check if every page in a TIF file is corrupted or not. Even partially corrupt also no problem http://bitmiracle.com/libtiff/ Thanks Adriaan Many tiff files won't open in the standard GDI+ .NET. That is, if you're running on Windows XP. Window 7 is much better. So any file which is not

How to convert a multi-page PDF to single-page TIFFs

筅森魡賤 提交于 2019-12-05 10:20:47
This thread asks for how to convert multi-page PDF to multi-page TIFF with Ghostscript; "Tools to convert multipage PDF to multipage TIFF" However, I want to covert a multi page PDF to a number of single-page TIFFs: Each page in the PDF is expected to be converted to a single TIFF file. So the above answer does not exactly match what I need. How can I achieve this? I am using Windows XP. Be sure to have a recent version of Ghostscript installed. Then you can run these commands: gs \ -o singlepage-tiffg4-%03d.tif \ -sDEVICE=tiffg4 \ multipage-input.pdf and gs \ -o singlepage-tiff24nc-%03d.tif \

matlab: how to save TIFF series?

自作多情 提交于 2019-12-05 07:47:36
Lets say I have a 3D array 'img' (x, y, frame) and want to save it as a TIFF. So far I was doing it by saving one-by-one like this: for K=1:length(img(1, 1, :)) outputFileName = sprintf('img_%d.tif',K); imwrite(img(:, :, K), outputFileName); end cool, but what if I want to save it as a one tiff stack? How to do it? Thanks :) Clement J. The parameter ' append ' seems to correspond to what you want. outputFileName = 'img_stack.tif' for K=1:length(img(1, 1, :)) imwrite(img(:, :, K), outputFileName, 'WriteMode', 'append'); end EDIT: IMAGEJ has problems when opening multipletiffs saved like that.

How can I get the StripOffsets tag to stay the same when using the LibTiff.Net 2.3 library?

廉价感情. 提交于 2019-12-04 19:48:38
I have an original image that has a tag StripOffsets = 768. When I edit the image in memory and then write it back to a file I try to specifically set the StripOffsets tag manually to the same value of the original which is 768 (using the following method). //Set the height for the page output.SetField(TiffTag.ROWSPERSTRIP, ttPage[i].Height); //Set the offset for the page output.SetField(TiffTag.STRIPOFFSETS, ttPage[i].StripOffset); For some reason the end results is StripOffsets = 8. Why will it not set the StripOffsets the way I want? On a side note that also effects my "Page offset" shown

Create JavaFX Image from PGM or TIFF as fast as possible

徘徊边缘 提交于 2019-12-04 19:02:39
I'm capturing images from a scanner device with java. The input format ist PGM or TIFF. I have to show up live results in the user interface. Actually I'm using ImageJ to read the source input stream as tiff, because ImageJ can also handle incomplete streams. After that the ImagePlus object is converted into a BufferedImage and finally into a JavaFX Image . ImagePlus imagePlus = new Opener().openTiff(inputStream, ""); BufferedImage bufferedImage = imagePlus.getBufferedImage(); Image image = SwingFXUtils.toFXImage(bufferedImage, null); This is very slow. I need a faster way to create the JavaFX

R: tiff( ) won't compress or set resolution to 300 ppi

*爱你&永不变心* 提交于 2019-12-04 18:21:22
I am trying to save some graphs using R for publication. I want to have them compressed with lzw and have the resolution at 300. For some reason it won't allow me to do this. In fact, it seems like R is ignoring some of the variables I set. For the code example, tiff(file="file.tiff", width=6.83, height=6.83, units="in", pointsize="12", compression = "lzw", bg="white", res=300, antialias = "none" ) outputs an uncompressed file of size 28 x 28 inches and a resolution of 72 ppi. A reproducable example would be hist(rnorm(1000)) dev.off() Here is the output of ImageMagick for file.tiff Image:

Write tiled output of TIFF, using ImageIO in Java

爱⌒轻易说出口 提交于 2019-12-04 14:13:07
What I have is a a large number of frames that need to be placed together in a larger image (like a mosaic). The required positions of the images are known. There are a very large number of images so loading them all into memory is impractical at best. Based on some other answers here I was able to override the methods in RenderedImage (specifically getData(rect) ) to load in the appropriate data and return it. This works just fine, however the image writer is always calling getData and requesting rows of data. It seems to me I should be able to change the ImageWriterParam to call for

TIFFReadDirectory Warnings when reading GeoTiff with QPixmap::load( )

我怕爱的太早我们不能终老 提交于 2019-12-04 11:05:32
I have a geotiff file which I am loading into a QPixmap with QPixmap::load( ). I get the following warnings printed to the console a bunch of times. However, direct use of libtiff opens it without warnings. Any ideas on how to alleviate these unsightly warnings in QT? TIFFReadDirectory: Warning, foo: unknown field with tag 33550 (0x830e) encountered. TIFFReadDirectory: Warning, foo: unknown field with tag 33922 (0x8482) encountered. TIFFReadDirectory: Warning, foo: unknown field with tag 34735 (0x87af) encountered. TIFFReadDirectory: Warning, foo: unknown field with tag 34736 (0x87b0)

Load a tiff stack in a numpy array with python

流过昼夜 提交于 2019-12-04 10:55:18
问题 Hallo Stack Overflow community, I am having a little issue with .tif files. I am sure it is only a minor problem that I can´t get around (keep in mind, I am a relatively new programmer). Basically: I have prepared .tif files that are 64x64xn in size (n up until 1000). The image is only a single file that contains all of this slices. I would like to load the image into a (multidimensional) numpy array. I have tried: from PIL import Image as pilimage file_path=(D:\luca\test\test.tif) print("The