Commit Graph

36 Commits

Author SHA1 Message Date
hugovk
1de128d6b6 Merge branch 'master' into flake8 2014-09-14 10:23:51 +03:00
wiredfool
81076d5f29 Don't copy input file for GS if not necessary, length variable name fix 2014-09-02 23:21:02 -07:00
wiredfool
ee46f45b96 Remove unused code, tighten up readline for all the line endings 2014-09-02 23:20:41 -07:00
wiredfool
8f75cc2bbf Don't search for the imagedata if we're not going to do anything with it 2014-09-02 23:20:33 -07:00
wiredfool
9b35a4538d Read the offset using original fp
Read the rest of the text data using one of the line ending
wrappers.
2014-09-02 23:20:23 -07:00
wiredfool
8193566ff1 Try to open the file in universal line ending mode, fallback to prev behavior 2014-09-02 23:20:05 -07:00
hugovk
42610c0ecd flake8 2014-08-28 17:18:54 +03:00
hugovk
8de95676e0 flake8 2014-08-26 16:47:10 +03:00
wiredfool
618a79c1c6 Merge from master, pre-unittest conversion 2014-06-03 14:42:22 -07:00
wiredfool
54173d2c67 Cherry-pick of portions of patch a500ca1393, many shortcut ops added, no functional changes 2014-05-09 21:36:15 -07:00
eliempje
d3192dd930 Update EpsImagePlugin.py
FIXED issue #302: https://github.com/python-imaging/Pillow/issues/302
EPS file can have binary preview. Header is now also read binary.

Also fix for resizing EPS. Resolution is now 2 dimensional and dependend on bbox and size.
2014-05-07 13:36:35 +02:00
eliempje
2cd6d416b2 Bugfix: EPS thumbnail failed
EPS thumbnail failed to resize correctly due to incorrect resolution argument (should be a function of the image size and bounding box). This is fixed in this commit.
2014-04-12 13:38:39 +02:00
wiredfool
82d7524add made has_ghostscript a method, using it from test_imagefile 2014-04-04 13:33:54 -07:00
wiredfool
1e331e3e6a Removed tempfile.mktemp, fixes CVE-2014-1932 CVE-2014-1933, debian bug #737059 2014-03-14 15:56:41 -07:00
Alex Clark ☺
5750d5d6ef Merge pull request #474 from sciunto/bool
Maint: minor patch on booleans + travis
2014-01-31 13:16:38 -08:00
wiredfool
a549e77bd8 Fix hang by using temp file and command line args instead of stdin 2014-01-21 23:18:24 -08:00
wiredfool
8ce2faa8c9 enable eps test in test_imagefile, test passes 2014-01-21 23:17:47 -08:00
cgohlke
4446f05ac0 Fix saving EPS to open file objects on Python 2.x
Fix issue #470 and #479
2014-01-21 21:14:32 -08:00
François Boulogne
ead121d951 MAINT replace is False by not 2014-01-08 22:07:35 -05:00
Esteban Santana Santana
8d27167fc7 More python3 fixes.
Changed the way the translate command that is passed to ghostscript is generated. This should now work on both python2.6+ and python3.
2013-11-20 02:54:31 -06:00
Esteban Santana Santana
3d1cd63afd We need to write bytes not strings.
Python3 compatibility issue, we need to write bytes to buffers and pipes, not strings. This should still work in python2.6+.
2013-11-20 02:41:35 -06:00
Esteban Santana Santana
9cd654917d Changed the Ghostscript() function inside of EpsImagePlugin to use subprocess.Popen() instead of the deprecated os.popen(). 2013-11-20 01:32:06 -06:00
Esteban Santana Santana
7989378bfd Added a way to specify the render size for EPS files.
There is now a scale parameter that you can pass in to the EpsImageFile.load() function. This parameter is used to specify at what scale Ghostscript renders the EPS internally. Scale needs to be an integer, and all of the internal structures (image size and bounding box) are scaled based on that parameter.
2013-11-17 01:26:44 -06:00
Christoph Gohlke
caba4e33ba Fix AttributeError: 'module' object has no attribute 'spawn' 2013-03-08 11:15:28 -08:00
Alex Clark
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
Kyle MacFarlane
de17144f6b Fix Ghostscript command on Windows 2013-03-06 17:36:22 +00:00
Brian Crowell
4f7d784a71 py3k: Actually fix the EPS encoder
The EPS encoder wasn't part of Gohlke's test suite, so the previous "fixes"
there were only expected syntactic ones. This gives a cleaner fix to the
encoder.

The decoder doesn't work in round-trip due to a missing eps_decoder method
on the core module, but it's clear it worked at some point.
2013-01-10 08:47:00 -06:00
Brian Crowell
a7e3b2e47b py3k: The big push
There are two main issues fixed with this commit:

* bytes vs. str: All file, image, and palette data are now handled as
  bytes. A new _binary module consolidates the hacks needed to do this
  across Python versions. tostring/fromstring methods have been renamed to
  tobytes/frombytes, but the Python 2.6/2.7 versions alias them to the old
  names for compatibility. Users should move to tobytes/frombytes.

  One other potentially-breaking change is that text data in image files
  (such as tags, comments) are now explicitly handled with a specific
  character encoding in mind. This works well with the Unicode str in
  Python 3, but may trip up old code expecting a straight byte-for-byte
  translation to a Python string. This also required a change to Gohlke's
  tags tests (in Tests/test_file_png.py) to expect Unicode strings from
  the code.

* True div vs. floor div: Many division operations used the "/" operator
  to do floor division, which is now the "//" operator in Python 3. These
  were fixed.

As of this commit, on the first pass, I have one failing test (improper
handling of a slice object in a C module, test_imagepath.py) in Python 3,
and three that that I haven't tried running yet (test_imagegl,
test_imagegrab, and test_imageqt). I also haven't tested anything on
Windows. All but the three skipped tests run flawlessly against Pythons
2.6 and 2.7.
2013-01-10 08:46:56 -06:00
Brian Crowell
31c454b925 py3k: 2to3's "idiom" filter
This is, I guess, a few things the Python devs were just fed up with.

* "while 1" is now "while True"
* Types are compared with isinstance instead of ==
* Sort a list in one go with sorted()

My own twist is to also replace type('') with str, type(()) with tuple,
type([]) with list, type(1) with int, and type(5000.0) with float.
2013-01-10 08:46:53 -06:00
Brian Crowell
e2283c664b py3k: Integer long literals are no longer valid syntax 2013-01-10 08:46:52 -06:00
Brian Crowell
83ff0b3b31 py3k: Use relative imports
In py3k, imports are absolute unless using the "from . import" syntax.

This commit also solves a recursive import between Image, ImageColor, and
ImagePalette by delay-importing ImagePalette in Image.

I'm not too keen on this commit because the syntax is ugly. I might go back
and prefer the prettier "from PIL import".
2013-01-10 08:46:48 -06:00
Brian Crowell
fc035814bd py3k: map and filter to list comprehensions
What's really going on is that map() and filter() return iterators in py3k.
I've just gone ahead and turned them all into list comprehensions, because
I find them much easier to read.
2013-01-10 08:46:43 -06:00
Brian Crowell
78575798d7 py3k: Update exception usage to modern syntax 2013-01-10 08:46:33 -06:00
Brian Crowell
37f22ebfcd py3k: Use string methods instead of string module
First, we go for the obvious stuff. The string module methods are gone in
3.0, so we translate them to the appropriate methods on the string class.
2013-01-10 08:42:49 -06:00
Tom Gross
33e1ffe570 fixed reading of EPS pictures
found in: http://www.mail-archive.com/image-sig@python.org/msg03054.html
2012-04-26 17:00:22 +02:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00