tiff

What is the best way to save image metadata alongside a tif?

杀马特。学长 韩版系。学妹 提交于 2019-12-22 03:54:49
问题 In my work as a grad student, I capture microscope images and use python to save them as raw tif's. I would like to add metadata such as the name of the microscope I am using, the magnification level, and the imaging laser wavelength. These details are all important for how I post-process the images. I should be able to do this with a tif, right? Since it has a header? I was able to add to the info in a PIL image: im.info['microscope'] = 'george' but when I save and load that image, the info

numpy.array of an “I;16” Image file

泪湿孤枕 提交于 2019-12-21 13:00:59
问题 I want to use TIFF images to effectively save large arrays of measurement data. With setting them to mode="I;16" (corresponding to my 16 bit data range), they yield 2MB files (~1000x1000 "pixel"). Which is good. However I am having troubles reconverting them into arrays when it comes to analysing them. For 32bit data (-> "I") the numpy.array command works fine. In case of "I;16" the result is a 0D numpy array with the TIFF as the [0,0] entry. Is there a way to get that to work? I would really

Reading tiff image metadata in Python

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 12:31:36
问题 How can I read metada, like coordinates, from a TIFF image in Python? I tried foo._getexif() from PIL, but got the message: AttributeError: 'TiffImageFile' object has no attribute '_getexif' Is it possible to get it with PIL? 回答1: from PIL import Image from PIL.TiffTags import TAGS with Image.open('image.tif') as img: meta_dict = {TAGS[key] : img.tag[key] for key in img.tag.iterkeys()} _getexif() is only meant to be used with JPEG. JPEG requires unpacking of the metadata, TIFF does not. That

ImageMagick or GhostScript: convert a multi-page TIFF to a multi-page PDF

南笙酒味 提交于 2019-12-21 11:36:49
问题 I need to convert a multi-page TIFF to a multi-page PDF. I have access to ImageMagick and GhostScript (in *nix environment). How do I do this? Thanks. UPDATE: It turns out that my test file was wrong (it didn't have multiple pages), which made me think my command was wrong. This seems to work for me: convert input.tif output.pdf 回答1: Use a tool called tiff2ps from the tool set provided by libtiff: http://www.libtiff.org/tools.html Once you have the tiff in ps format, you can call ps2pdf to

In a TIFF create a Sub IFD with thumbnail (libtiff)

别等时光非礼了梦想. 提交于 2019-12-20 21:20:10
问题 I know thumbnail.c includes some code that creates a thumbnail and places it in a sub IDF, but there is a lot going on in that code (generating the thumbnail, applying a contrast curve, etc.) and I am having difficulty reproducing just writing a thumbnail. Google has not been any help either. My question is, after I have opened an output file and have a TIFF*, I have my thumbnail data all ready to go (as well as my main image data), how do I add them in such a way that the thumbnail is in a

How to read a big tif file in python?

こ雲淡風輕ζ 提交于 2019-12-20 15:26:06
问题 I'm loading a tiff file from http://oceancolor.gsfc.nasa.gov/DOCS/DistFromCoast/ from PIL import Image im = Image.open('GMT_intermediate_coast_distance_01d.tif') The data is large ( im.size=(36000, 18000) 1.3GB) and conventional conversion doesn't work; i.e, imarray.shape returns () import numpy as np imarray=np.zeros(im.size) imarray=np.array(im) How can I convert this tiff file to a numpy.array ? 回答1: May you dont have too much Ram for this image.You'll need at least some more than 1.3GB

Graphics folder modules will not import after several installs (Mac OSX)

半腔热情 提交于 2019-12-20 04:43:11
问题 A similar problem with the python gdal module Gdal will not import after several installs (Mac OSX) was solved by modifying my shell profile to ensure MacPorts-installed ports are found, and then using sudo port select python python27 . But this time it's every module in my graphics folder that deals with tiff and png reading and writing that will not import: tiff @3.9.5 graphics/tiff pngpp @0.2.3 graphics/pngpp libgeotiff @1.3.0 graphics/libgeotiff Again, when I run python to import either

Issue in getImageWritersByFormatName for Tiff. Getting image writer

萝らか妹 提交于 2019-12-20 04:19:53
问题 I am trying to convert PDF to tif images. I use following code to get the image writers by format. Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("TIFF"); if (writers == null || !writers.hasNext()) { throw new ImageWritingException(); } This works fine when I run the application standalone in Eclipse. But when I deploy the application to tomcat server in linux, writers==null is false but !writers.hasNext is true resulting to throw Exception. I use maven to build the

After applying CCITT compression on my Tiff File, it produces an image with a solid black background

半城伤御伤魂 提交于 2019-12-20 03:10:55
问题 Creating tiff file, with LZW compression (default):- System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(800, 1000); Graphics g = Graphics.FromImage(bitmap); g.DrawString("Name: " + Name.Text, outputFont, Brushes.Black, new PointF(0, 20)); g.DrawString("Date Of Birth: " + Date_Of_Birth.Text, outputFont, Brushes.Black, new PointF(0, 40)); g.DrawString("Address: " + Address.Text, outputFont, Brushes.Black, new PointF(0, 60)); g.DrawString("City: " + City.Text, outputFont, Brushes.Black,

After applying CCITT compression on my Tiff File, it produces an image with a solid black background

旧时模样 提交于 2019-12-20 03:08:37
问题 Creating tiff file, with LZW compression (default):- System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(800, 1000); Graphics g = Graphics.FromImage(bitmap); g.DrawString("Name: " + Name.Text, outputFont, Brushes.Black, new PointF(0, 20)); g.DrawString("Date Of Birth: " + Date_Of_Birth.Text, outputFont, Brushes.Black, new PointF(0, 40)); g.DrawString("Address: " + Address.Text, outputFont, Brushes.Black, new PointF(0, 60)); g.DrawString("City: " + City.Text, outputFont, Brushes.Black,