Skip to content

Commit

Permalink
Merge branch 'main' into eps_plugin_perf
Browse files Browse the repository at this point in the history
  • Loading branch information
Yay295 committed Jan 11, 2023
2 parents c3134dc + c683f04 commit 651b352
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 7 additions & 7 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -369,21 +369,21 @@ Build Options
available, as many as are present.

* Build flags: ``--disable-zlib``, ``--disable-jpeg``,
``--disable-tiff``, ``--disable-freetype``, ``--disable-lcms``,
``--disable-webp``, ``--disable-webpmux``, ``--disable-jpeg2000``,
``--disable-imagequant``, ``--disable-xcb``.
``--disable-tiff``, ``--disable-freetype``, ``--disable-raqm``,
``--disable-lcms``, ``--disable-webp``, ``--disable-webpmux``,
``--disable-jpeg2000``, ``--disable-imagequant``, ``--disable-xcb``.
Disable building the corresponding feature even if the development
libraries are present on the building machine.

* Build flags: ``--enable-zlib``, ``--enable-jpeg``,
``--enable-tiff``, ``--enable-freetype``, ``--enable-lcms``,
``--enable-webp``, ``--enable-webpmux``, ``--enable-jpeg2000``,
``--enable-imagequant``, ``--enable-xcb``.
``--enable-tiff``, ``--enable-freetype``, ``--enable-raqm``,
``--enable-lcms``, ``--enable-webp``, ``--enable-webpmux``,
``--enable-jpeg2000``, ``--enable-imagequant``, ``--enable-xcb``.
Require that the corresponding feature is built. The build will raise
an exception if the libraries are not found. Webpmux (WebP metadata)
relies on WebP support. Tcl and Tk also must be used together.

* Build flags: ``--vendor-raqm --vendor-fribidi``
* Build flags: ``--vendor-raqm``, ``--vendor-fribidi``.
These flags are used to compile a modified version of libraqm and
a shim that dynamically loads libfribidi at runtime. These are
used to compile the standard Pillow wheels. Compiling libraqm requires
Expand Down
11 changes: 6 additions & 5 deletions src/PIL/EpsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,21 +339,22 @@ def check_required_header_comments():
raise OSError(msg)

def _find_offset(self, fp):
s = fp.read(160)
s = fp.read(4)

if s[:4] == b"%!PS":
if s == b"%!PS":
# for HEAD without binary preview
fp.seek(0, io.SEEK_END)
length = fp.tell()
offset = 0
elif i32(s, 0) == 0xC6D3D0C5:
elif i32(s) == 0xC6D3D0C5:
# FIX for: Some EPS file not handled correctly / issue #302
# EPS can contain binary data
# or start directly with latin coding
# more info see:
# https://web.archive.org/web/20160528181353/http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
offset = i32(s, 4)
length = i32(s, 8)
s = fp.read(8)
offset = i32(s)
length = i32(s, 4)
else:
msg = "not an EPS file"
raise SyntaxError(msg)
Expand Down

0 comments on commit 651b352

Please sign in to comment.