Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New libtiff package #7345

Closed
TimDumol mannequin opened this issue Oct 29, 2009 · 21 comments
Closed

New libtiff package #7345

TimDumol mannequin opened this issue Oct 29, 2009 · 21 comments

Comments

@TimDumol
Copy link
Mannequin

TimDumol mannequin commented Oct 29, 2009

This is used by PIL (c.f. #7273). Inclusion as an optional or even as a standard package would be helpful.

The package is here: http://sage.math.washington.edu/home/timdumol/libtiff-3.9.5.spkg

Component: packages: optional

Keywords: sd32

Author: Tim Dumol

Issue created by migration from https://trac.sagemath.org/ticket/7345

@TimDumol TimDumol mannequin assigned boothby Oct 29, 2009
@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 1, 2009

comment:1

Should this belong to a different component?

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 1, 2009

comment:2

Woops. Yep.

@jhpalmieri
Copy link
Member

comment:3

Builds fine on Mac OS X 10.6 and sage.math, and installs what look like the right libraries in the right place. What can I do to test it?

I've marked it as "needs work" because the SPKG.txt file says "libjpeg" several places instead of "libtiff".

Is the spkg-install file modeled after other ones currently in use? (Will drkirby complain about gnuisms, for instance, or is this derived from one of his spkg-install files?)

@jhpalmieri
Copy link
Member

comment:4

Oh, there is also a file SPKG.txt~ which should not be there.

@kcrisman
Copy link
Member

kcrisman commented Aug 2, 2010

comment:5

See also here.

@boothby boothby assigned TimDumol and unassigned boothby Aug 2, 2010
@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Aug 17, 2010

comment:7

Updated version found here: http://sage.math.washington.edu/home/timdumol/libtiff-3.9.4.spkg

This should fix the OS X 10.6 problems (c.f. #7344).

sage: import Image
sage: im = Image.open("<your-tiff-file-here>")
sage: im = im.resize((im.size[0]/2,im.size[1]/2))
sage: print im.format, im.size, im.mode
TIFF (455, 495) 1
sage: im.show()
sage: im.save("wherever.tiff")

@TimDumol

This comment has been minimized.

@TimDumol TimDumol mannequin added s: needs review and removed s: needs work labels Aug 17, 2010
@sagetrac-mariah
Copy link
Mannequin

sagetrac-mariah mannequin commented May 13, 2011

comment:8

http://libtiff.org says latest version is 3.6.1, yet this
spkg is labeled 3.9.4. Why?

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Aug 2, 2011

comment:9

The web page itself is outdated. The downloads page: ftp://ftp.remotesensing.org/pub/libtiff actually states that the latest package is 3.9.5.

@TimDumol TimDumol mannequin added s: needs review and removed s: needs info labels Aug 2, 2011
@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Aug 2, 2011

comment:11

New package here: http://sage.math.washington.edu/home/timdumol/libtiff-3.9.5.spkg

@TimDumol

This comment has been minimized.

@TimDumol TimDumol mannequin added s: needs review and removed s: needs work labels Aug 2, 2011
@jhpalmieri
Copy link
Member

comment:12

There are some problems on OS X:

sage: im = Image.open('/Users/palmieri/Desktop/P1000717.tiff')
sage: im.show()
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
...
IOError: encoder jpeg not available
sage: im = im.resize((im.size[0]/2,im.size[1]/2))
sage: print im.format
None

By the way, according to ImageMagick's "identify" program:

$ identify P1000717.tiff 
P1000717.tiff TIFF 3648x2736 3648x2736+0+0 DirectClass 8-bit 28.5613mb 

So I think it's the right format to be opened by this library. Is there anything else I should check?

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Aug 3, 2011

comment:13

In the notebook, im.show() saves a JPEG into the worksheet directory, which is then automatically displayed by the SageNB. Thus, the error you got was actually because PIL has no access to libjpeg, and is thus not related to this package.

@TimDumol TimDumol mannequin added s: needs review and removed s: needs work labels Aug 3, 2011
@jhpalmieri
Copy link
Member

comment:14

I was actually working from the command line, but anyway, what about this part:

sage: im = im.resize((im.size[0]/2,im.size[1]/2))
sage: print im.format
None

According to the earlier example, this should have said "TIFF".

@jhpalmieri
Copy link
Member

comment:15

By the way, I can successfully save the resized image. Somewhere along the line I reinstalled PIL, so I don't know if that's necessary.

@jhpalmieri
Copy link
Member

comment:16

Two things: since this package installs files into SAGE_ROOT/local/bin, you should add those files to .hgignore — this will require a separate patch to the scripts repo. Also the spkg file contains "SPKG.txt~", which shouldn't be there.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Aug 4, 2011

comment:17

Replying to @TimDumol:

In the notebook, im.show() saves a JPEG into the worksheet directory, which is then automatically displayed by the SageNB.

May I ask why? Does it make any sense to convert a "lossless image" into a lossy format, i.e., why not convert it to e.g. PNG which any (GUI) browser should be able to display?

(I know TIFF is also a "meta format", i.e. you can encapsulate JPEGs in a TIFF file, but John's example file doesn't look like it was such.)

The only reason I can imagine is that it's easier to scale JPEG images than bitmaps, but unless we include the batteries by default, a simple show() of a bitmap image shouldn't require libjpeg.

@williamstein
Copy link
Contributor

Changed keywords from none to sd32

@sagetrac-janssen
Copy link
Mannequin

sagetrac-janssen mannequin commented Nov 12, 2011

comment:19

Regarding the im.format printing as None, that's OK, since the format attribute is only defined if the image was loaded from a file.

Regarding the action of Image.show(): Leif is right, using JPEG is a bad idea. Using TIFF is also a bad idea, for this purpose, as the PIL TIFF encoder only saves uncompressed TIFF files. They're big and slow. I second the idea of using PNG for Image.show(). But that really is a separate issue, and should be broken out as such.

@sagetrac-janssen
Copy link
Mannequin

sagetrac-janssen mannequin commented Nov 12, 2011

comment:20

Hmm, I see that JPEG is hard-coded into PIL 1.1.6. In PIL 1.1.7, im.show() uses a non-lossy format, and the user can override the viewer used by show(), so one custom-designed for Sage could be put in there if necessary.

@mkoeppe
Copy link
Member

mkoeppe commented Aug 26, 2021

comment:22

outdated, should close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants