mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
Removed trailing whitespace
This commit is contained in:
parent
c4a16b6967
commit
6bd7e7f02d
|
@ -325,7 +325,7 @@ Changelog (Pillow)
|
|||
- Adjust buffer size when quality=keep, fixes #148 (again)
|
||||
[wiredfool]
|
||||
|
||||
- Fix for corrupted bitmaps embedded in truetype fonts. #1072
|
||||
- Fix for corrupted bitmaps embedded in truetype fonts. #1072
|
||||
[jackyyf, wiredfool]
|
||||
|
||||
2.7.0 (2015-01-01)
|
||||
|
@ -412,7 +412,7 @@ Changelog (Pillow)
|
|||
2.6.2 (2015-01-01)
|
||||
------------------
|
||||
|
||||
- Fix CVE-2014-9601, potential PNG decompression DOS #1060
|
||||
- Fix CVE-2014-9601, potential PNG decompression DOS #1060
|
||||
[wiredfool]
|
||||
|
||||
- Fix Regression in PyPy 2.4 in streamio #958
|
||||
|
@ -1081,7 +1081,7 @@ Changelog (Pillow)
|
|||
|
||||
.. Note:: Special thanks to Christoph Gohlke and Eric Soroos for assisting with a pre-PyCon 2013 release!
|
||||
|
||||
- Many other bug fixes and enhancements by many other people.
|
||||
- Many other bug fixes and enhancements by many other people.
|
||||
|
||||
- Add Python 3 support. (Pillow >= 2.0.0 supports Python 2.6, 2.7, 3.2, 3.3. Pillow < 2.0.0 supports Python 2.4, 2.5, 2.6, 2.7.)
|
||||
[fluggo]
|
||||
|
|
|
@ -2269,7 +2269,7 @@ def open(fp, mode="r"):
|
|||
return im
|
||||
except (SyntaxError, IndexError, TypeError, struct.error):
|
||||
# Leave disabled by default, spams the logs with image
|
||||
# opening failures that are entirely expected.
|
||||
# opening failures that are entirely expected.
|
||||
#logger.debug("", exc_info=True)
|
||||
continue
|
||||
return None
|
||||
|
|
|
@ -42,8 +42,8 @@ Released as needed for security, installation or critical bug fixes.
|
|||
```
|
||||
* [ ] In compliance with https://www.python.org/dev/peps/pep-0440/, update version identifier in:
|
||||
```
|
||||
PIL/__init__.py
|
||||
setup.py
|
||||
PIL/__init__.py
|
||||
setup.py
|
||||
_imaging.c
|
||||
appveyor.yml
|
||||
```
|
||||
|
|
|
@ -144,7 +144,7 @@ level of support for it is arguably not important.</p>
|
|||
<tr>
|
||||
<td class=q>q/pal8rletrns.bmp</td>
|
||||
<td>3</td>
|
||||
<td class=b><img src="pal8rletrns.png"><br>
|
||||
<td class=b><img src="pal8rletrns.png"><br>
|
||||
or<br><img src="pal8rletrns-0.png"><br>
|
||||
or<br><img src="pal8rletrns-b.png"></td>
|
||||
<td class=b><img src="../q/pal8rletrns.bmp"></td>
|
||||
|
|
|
@ -251,7 +251,7 @@ class TestFileTiff(PillowTestCase):
|
|||
{256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,),
|
||||
262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,),
|
||||
279: (9460,), 282: ((720000, 10000),),
|
||||
283: ((720000, 10000),), 284: (1,)})
|
||||
283: ((720000, 10000),), 284: (1,)})
|
||||
|
||||
def test__delitem__(self):
|
||||
filename = "Tests/images/pil136.tiff"
|
||||
|
|
|
@ -395,8 +395,8 @@ getlist(PyObject* arg, int* length, const char* wrong_length, int type)
|
|||
|
||||
for (i = 0; i < n; i++) {
|
||||
op = PySequence_Fast_GET_ITEM(seq, i);
|
||||
// DRY, branch prediction is going to work _really_ well
|
||||
// on this switch. And 3 fewer loops to copy/paste.
|
||||
// DRY, branch prediction is going to work _really_ well
|
||||
// on this switch. And 3 fewer loops to copy/paste.
|
||||
switch (type) {
|
||||
case TYPE_UINT8:
|
||||
itemp = PyInt_AsLong(op);
|
||||
|
@ -3101,7 +3101,7 @@ static struct PyMethodDef methods[] = {
|
|||
{"unsharp_mask", (PyCFunction)_unsharp_mask, 1},
|
||||
#endif
|
||||
|
||||
{"box_blur", (PyCFunction)_box_blur, 1},
|
||||
{"box_blur", (PyCFunction)_box_blur, 1},
|
||||
|
||||
#ifdef WITH_EFFECTS
|
||||
/* Special effects */
|
||||
|
|
|
@ -49,7 +49,7 @@ http://www.cazabon.com\n\
|
|||
|
||||
/* known to-do list with current version:
|
||||
|
||||
Verify that PILmode->littleCMStype conversion in findLCMStype is correct for all
|
||||
Verify that PILmode->littleCMStype conversion in findLCMStype is correct for all
|
||||
PIL modes (it probably isn't for the more obscure ones)
|
||||
|
||||
Add support for creating custom RGB profiles on the fly
|
||||
|
@ -454,7 +454,7 @@ createProfile(PyObject *self, PyObject *args)
|
|||
}
|
||||
else if (strcmp(sColorSpace, "XYZ") == 0) {
|
||||
hProfile = cmsCreateXYZProfile();
|
||||
}
|
||||
}
|
||||
else if (strcmp(sColorSpace, "sRGB") == 0) {
|
||||
hProfile = cmsCreate_sRGBProfile();
|
||||
}
|
||||
|
@ -554,10 +554,10 @@ _profile_getattr(CmsProfileObject* self, cmsInfoType field)
|
|||
{
|
||||
// UNDONE -- check that I'm getting the right fields on these.
|
||||
// return PyUnicode_DecodeFSDefault(cmsTakeProductName(self->profile));
|
||||
//wchar_t buf[256]; -- UNDONE need wchar_t for unicode version.
|
||||
//wchar_t buf[256]; -- UNDONE need wchar_t for unicode version.
|
||||
char buf[256];
|
||||
cmsUInt32Number written;
|
||||
written = cmsGetProfileInfoASCII(self->profile,
|
||||
written = cmsGetProfileInfoASCII(self->profile,
|
||||
field,
|
||||
"en",
|
||||
"us",
|
||||
|
@ -566,40 +566,40 @@ _profile_getattr(CmsProfileObject* self, cmsInfoType field)
|
|||
if (written) {
|
||||
return PyUnicode_FromString(buf);
|
||||
}
|
||||
// UNDONE suppressing error here by sending back blank string.
|
||||
// UNDONE suppressing error here by sending back blank string.
|
||||
return PyUnicode_FromString("");
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
cms_profile_getattr_product_desc(CmsProfileObject* self, void* closure)
|
||||
{
|
||||
{
|
||||
// description was Description != 'Copyright' || or "%s - %s" (manufacturer, model) in 1.x
|
||||
return _profile_getattr(self, cmsInfoDescription);
|
||||
}
|
||||
|
||||
/* use these four for the individual fields.
|
||||
/* use these four for the individual fields.
|
||||
*/
|
||||
static PyObject*
|
||||
cms_profile_getattr_product_description(CmsProfileObject* self, void* closure)
|
||||
{
|
||||
{
|
||||
return _profile_getattr(self, cmsInfoDescription);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
cms_profile_getattr_product_model(CmsProfileObject* self, void* closure)
|
||||
{
|
||||
{
|
||||
return _profile_getattr(self, cmsInfoModel);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
cms_profile_getattr_product_manufacturer(CmsProfileObject* self, void* closure)
|
||||
{
|
||||
{
|
||||
return _profile_getattr(self, cmsInfoManufacturer);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
cms_profile_getattr_product_copyright(CmsProfileObject* self, void* closure)
|
||||
{
|
||||
{
|
||||
return _profile_getattr(self, cmsInfoCopyright);
|
||||
}
|
||||
|
||||
|
|
12
_imagingft.c
12
_imagingft.c
|
@ -128,11 +128,11 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
|
|||
/* Don't free this before FT_Done_Face */
|
||||
self->font_bytes = PyMem_Malloc(font_bytes_size);
|
||||
if (!self->font_bytes) {
|
||||
error = 65; // Out of Memory in Freetype.
|
||||
error = 65; // Out of Memory in Freetype.
|
||||
}
|
||||
if (!error) {
|
||||
memcpy(self->font_bytes, font_bytes, (size_t)font_bytes_size);
|
||||
error = FT_New_Memory_Face(library, (FT_Byte*)self->font_bytes,
|
||||
error = FT_New_Memory_Face(library, (FT_Byte*)self->font_bytes,
|
||||
font_bytes_size, index, &self->face);
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
|
|||
if (error) {
|
||||
if (self->font_bytes) {
|
||||
PyMem_Free(self->font_bytes);
|
||||
}
|
||||
}
|
||||
PyObject_Del(self);
|
||||
return geterror(error);
|
||||
}
|
||||
|
@ -228,8 +228,8 @@ font_getsize(FontObject* self, PyObject* args)
|
|||
x += delta.x;
|
||||
}
|
||||
|
||||
/* Note: bitmap fonts within ttf fonts do not work, see #891/pr#960
|
||||
* Yifu Yu<root@jackyyf.com>, 2014-10-15
|
||||
/* Note: bitmap fonts within ttf fonts do not work, see #891/pr#960
|
||||
* Yifu Yu<root@jackyyf.com>, 2014-10-15
|
||||
*/
|
||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP);
|
||||
if (error)
|
||||
|
@ -443,7 +443,7 @@ font_dealloc(FontObject* self)
|
|||
FT_Done_Face(self->face);
|
||||
if (self->font_bytes) {
|
||||
PyMem_Free(self->font_bytes);
|
||||
}
|
||||
}
|
||||
PyObject_Del(self);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ apply(PyObject *self, PyObject* args)
|
|||
unsigned char b7 = nrow[col_idx]&1;
|
||||
unsigned char b8 = nrow[cip]&1;
|
||||
|
||||
int lut_idx = (b0
|
||||
int lut_idx = (b0
|
||||
|(b1 << 1)
|
||||
|(b2 << 2)
|
||||
|(b3 << 3)
|
||||
|
@ -199,7 +199,7 @@ match(PyObject *self, PyObject* args)
|
|||
unsigned char b7 = nrow[col_idx]&1;
|
||||
unsigned char b8 = nrow[cip]&1;
|
||||
|
||||
int lut_idx = (b0
|
||||
int lut_idx = (b0
|
||||
|(b1 << 1)
|
||||
|(b2 << 2)
|
||||
|(b3 << 3)
|
||||
|
|
|
@ -33,11 +33,11 @@ Download Python 3.4, install it, and add it to the path. This is the
|
|||
Python that we will use to bootstrap the build process. (The download
|
||||
routines are using 3.2+ features, and installing 3.4 gives us pip and
|
||||
virtualenv as well, reducing the number of packages that we need to
|
||||
install.)
|
||||
install.)
|
||||
|
||||
Download the rest of the Pythons by opening a command window, changing
|
||||
to the `winbuild` directory, and running `python
|
||||
get_pythons.py`.
|
||||
get_pythons.py`.
|
||||
|
||||
UNDONE -- gpg verify the signatures (note that we can download from
|
||||
https)
|
||||
|
@ -67,13 +67,13 @@ Dependencies
|
|||
|
||||
The script 'build_dep.py' downloads and builds the dependencies. Open
|
||||
a command window, change directory into `winbuild` and run `python
|
||||
build_dep.py`.
|
||||
build_dep.py`.
|
||||
|
||||
This will download libjpeg, libtiff, libz, and freetype. It will then
|
||||
compile 32 and 64-bit versions of the libraries, with both versions of
|
||||
the compilers.
|
||||
the compilers.
|
||||
|
||||
UNDONE -- lcms fails.
|
||||
UNDONE -- lcms fails.
|
||||
UNDONE -- webp, jpeg2k not recognized
|
||||
|
||||
Building Pillow
|
||||
|
@ -82,7 +82,7 @@ Building Pillow
|
|||
Once the dependencies are built, run `python build.py --clean` to
|
||||
build and install Pillow in virtualenvs for each python
|
||||
build. `build.py --dist` will build Windows installers instead of
|
||||
installing into virtualenvs.
|
||||
installing into virtualenvs.
|
||||
|
||||
UNDONE -- suppressed output, what about failures.
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ Bands
|
|||
An image can consist of one or more bands of data. The Python Imaging Library
|
||||
allows you to store several bands in a single image, provided they all have the
|
||||
same dimensions and depth. For example, a PNG image might have 'R', 'G', 'B',
|
||||
and 'A' bands for the red, green, blue, and alpha transparency values. Many
|
||||
and 'A' bands for the red, green, blue, and alpha transparency values. Many
|
||||
operations act on each band separately, e.g., histograms. It is often useful to
|
||||
think of each pixel as having one value per band.
|
||||
|
||||
To get the number and names of bands in an image, use the
|
||||
:py:meth:`~PIL.Image.Image.getbands` method.
|
||||
:py:meth:`~PIL.Image.Image.getbands` method.
|
||||
|
||||
.. _concept-modes:
|
||||
|
||||
|
@ -43,7 +43,7 @@ PIL also provides limited support for a few special modes, including ``LA`` (L
|
|||
with alpha), ``RGBX`` (true color with padding) and ``RGBa`` (true color with
|
||||
premultiplied alpha). However, PIL doesn’t support user-defined modes; if you
|
||||
to handle band combinations that are not listed above, use a sequence of Image
|
||||
objects.
|
||||
objects.
|
||||
|
||||
You can read the mode of an image through the :py:attr:`~PIL.Image.Image.mode`
|
||||
attribute. This is a string containing one of the above values.
|
||||
|
|
|
@ -471,13 +471,13 @@ The :py:meth:`~PIL.Image.Image.open` method sets the following
|
|||
.. versionadded:: 1.1.5
|
||||
|
||||
**resolution**
|
||||
Image resolution as an ``(xres, yres)`` tuple, where applicable. This is a
|
||||
Image resolution as an ``(xres, yres)`` tuple, where applicable. This is a
|
||||
measurement in whichever unit is specified by the file.
|
||||
|
||||
.. versionadded:: 1.1.5
|
||||
|
||||
|
||||
The :py:attr:`~PIL.Image.Image.tag_v2` attribute contains a dictionary of
|
||||
The :py:attr:`~PIL.Image.Image.tag_v2` attribute contains a dictionary of
|
||||
TIFF metadata. The keys are numerical indexes from `~PIL.TiffTags.TAGS_V2`.
|
||||
Values are strings or numbers for single items, multiple values are returned
|
||||
in a tuple of values. Rational numbers are returned as a single value.
|
||||
|
|
|
@ -81,7 +81,7 @@ Example: Draw Partial Opacity Text
|
|||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
# get an image
|
||||
base = Image.open('Pillow/Tests/images/lena.png').convert('RGBA')
|
||||
base = Image.open('Pillow/Tests/images/lena.png').convert('RGBA')
|
||||
|
||||
# make a blank image for the text, initialized to transparent text color
|
||||
txt = Image.new('RGBA', base.size, (255,255,255,0))
|
||||
|
@ -89,7 +89,7 @@ Example: Draw Partial Opacity Text
|
|||
# get a font
|
||||
fnt = ImageFont.truetype('Pillow/Tests/fonts/FreeMono.ttf', 40)
|
||||
# get a drawing context
|
||||
d = ImageDraw.Draw(txt)
|
||||
d = ImageDraw.Draw(txt)
|
||||
|
||||
# draw text, half opacity
|
||||
d.text((10,10), "Hello", font=fnt, fill=(255,255,255,128))
|
||||
|
|
|
@ -27,7 +27,7 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
|
|||
|
||||
In the current version, :py:mod:`~PIL.ImageMath` only supports
|
||||
single-layer images. To process multi-band images, use the
|
||||
:py:meth:`~PIL.Image.Image.split` method or :py:func:`~PIL.Image.merge`
|
||||
:py:meth:`~PIL.Image.Image.split` method or :py:func:`~PIL.Image.merge`
|
||||
function.
|
||||
|
||||
:param expression: A string which uses the standard Python expression
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
:py:mod:`ImageMorph` Module
|
||||
===========================
|
||||
|
||||
The :py:mod:`ImageMorph` module provides morphology operations on images.
|
||||
The :py:mod:`ImageMorph` module provides morphology operations on images.
|
||||
|
||||
.. automodule:: PIL.ImageMorph
|
||||
:members:
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
The :py:mod:`OleFileIO` module reads Microsoft OLE2 files (also called
|
||||
Structured Storage or Microsoft Compound Document File Format), such
|
||||
as Microsoft Office documents, Image Composer and FlashPix files, and
|
||||
Outlook messages.
|
||||
Outlook messages.
|
||||
|
||||
This module is the `OleFileIO\_PL`_ project by Philippe Lagadec, v0.30,
|
||||
merged back into Pillow.
|
||||
merged back into Pillow.
|
||||
|
||||
.. _OleFileIO\_PL: http://www.decalage.info/python/olefileio
|
||||
|
||||
|
@ -300,7 +300,7 @@ Close the OLE file
|
|||
|
||||
Unless your application is a simple script that terminates after
|
||||
processing an OLE file, do not forget to close each OleFileIO object
|
||||
after parsing to close the file on disk.
|
||||
after parsing to close the file on disk.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
The PixelAccess class provides read and write access to
|
||||
:py:class:`PIL.Image` data at a pixel level.
|
||||
|
||||
.. note:: Accessing individual pixels is fairly slow. If you are looping over all of the pixels in an image, there is likely a faster way using other parts of the Pillow API.
|
||||
.. note:: Accessing individual pixels is fairly slow. If you are looping over all of the pixels in an image, there is likely a faster way using other parts of the Pillow API.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
@ -228,7 +228,7 @@ Plugin reference
|
|||
:mod:`PngImagePlugin` Module
|
||||
----------------------------
|
||||
|
||||
.. automodule:: PIL.PngImagePlugin
|
||||
.. automodule:: PIL.PngImagePlugin
|
||||
:members: ChunkStream, PngImageFile, PngStream, getchunks, is_cid, putchunk
|
||||
:show-inheritance:
|
||||
.. autoclass:: PIL.PngImagePlugin.ChunkStream
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
Sane Plugin
|
||||
-----------
|
||||
|
||||
The Sane plugin has now been split into its own repo:
|
||||
https://github.com/python-pillow/Sane .
|
||||
The Sane plugin has now been split into its own repo:
|
||||
https://github.com/python-pillow/Sane .
|
||||
|
||||
|
||||
Png text chunk size limits
|
||||
|
@ -14,7 +14,7 @@ Png text chunk size limits
|
|||
To prevent potential denial of service attacks using compressed text
|
||||
chunks, there are now limits to the decompressed size of text chunks
|
||||
decoded from PNG images. If the limits are exceeded when opening a PNG
|
||||
image a ``ValueError`` will be raised.
|
||||
image a ``ValueError`` will be raised.
|
||||
|
||||
Individual text chunks are limited to
|
||||
:py:attr:`PIL.PngImagePlugin.MAX_TEXT_CHUNK`, set to 1MB by
|
||||
|
|
|
@ -31,7 +31,7 @@ Deprecated Methods
|
|||
Several methods that have been marked as deprecated for many releases
|
||||
have been removed in this release::
|
||||
|
||||
Image.tostring()
|
||||
Image.tostring()
|
||||
Image.fromstring()
|
||||
Image.offset()
|
||||
ImageDraw.setink()
|
||||
|
@ -47,6 +47,6 @@ LibJpeg and Zlib are Required by Default
|
|||
|
||||
The external dependencies on libjpeg and zlib are now required by default.
|
||||
If the headers or libraries are not found, then installation will abort
|
||||
with an error. This behaviour can be disabled with the ``--disable-libjpeg``
|
||||
and ``--disable-zlib`` flags.
|
||||
with an error. This behaviour can be disabled with the ``--disable-libjpeg``
|
||||
and ``--disable-zlib`` flags.
|
||||
|
||||
|
|
4
encode.c
4
encode.c
|
@ -554,7 +554,7 @@ static unsigned int* get_qtables_arrays(PyObject* qtables, int* qtablesLen) {
|
|||
tables = PySequence_Fast(qtables, "expected a sequence");
|
||||
num_tables = PySequence_Size(qtables);
|
||||
if (num_tables < 1 || num_tables > NUM_QUANT_TBLS) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Not a valid number of quantization tables. Should be between 1 and 4.");
|
||||
Py_DECREF(tables);
|
||||
return NULL;
|
||||
|
@ -582,7 +582,7 @@ static unsigned int* get_qtables_arrays(PyObject* qtables, int* qtablesLen) {
|
|||
Py_DECREF(table_data);
|
||||
}
|
||||
|
||||
*qtablesLen = num_tables;
|
||||
*qtablesLen = num_tables;
|
||||
|
||||
JPEG_QTABLES_ERR:
|
||||
Py_DECREF(tables); // Run on both error and not error
|
||||
|
|
|
@ -259,14 +259,14 @@ rgb2hsv(UINT8* out, const UINT8* in, int xsize)
|
|||
g = in[1];
|
||||
b = in[2];
|
||||
|
||||
maxc = MAX(r,MAX(g,b));
|
||||
maxc = MAX(r,MAX(g,b));
|
||||
minc = MIN(r,MIN(g,b));
|
||||
uv = maxc;
|
||||
if (minc == maxc){
|
||||
*out++ = 0;
|
||||
*out++ = 0;
|
||||
*out++ = uv;
|
||||
} else {
|
||||
} else {
|
||||
cr = (float)(maxc-minc);
|
||||
s = cr/(float)maxc;
|
||||
rc = ((float)(maxc-r))/cr;
|
||||
|
@ -280,7 +280,7 @@ rgb2hsv(UINT8* out, const UINT8* in, int xsize)
|
|||
h = 4.0 + gc-rc;
|
||||
}
|
||||
// incorrect hue happens if h/6 is negative.
|
||||
h = fmod((h/6.0 + 1.0), 1.0);
|
||||
h = fmod((h/6.0 + 1.0), 1.0);
|
||||
|
||||
uh = (UINT8)CLIP((int)(h*255.0));
|
||||
us = (UINT8)CLIP((int)(s*255.0));
|
||||
|
@ -313,10 +313,10 @@ hsv2rgb(UINT8* out, const UINT8* in, int xsize)
|
|||
*out++ = v;
|
||||
*out++ = v;
|
||||
*out++ = v;
|
||||
} else {
|
||||
} else {
|
||||
i = floor((float)h * 6.0 / 255.0); // 0 - 6
|
||||
f = (float)h * 6.0 / 255.0 - (float)i; // 0-1 : remainder.
|
||||
fs = ((float)s)/255.0;
|
||||
f = (float)h * 6.0 / 255.0 - (float)i; // 0-1 : remainder.
|
||||
fs = ((float)s)/255.0;
|
||||
|
||||
p = round((float)v * (1.0-fs));
|
||||
q = round((float)v * (1.0-fs*f));
|
||||
|
@ -326,32 +326,32 @@ hsv2rgb(UINT8* out, const UINT8* in, int xsize)
|
|||
ut = (UINT8)CLIP(t);
|
||||
|
||||
switch (i%6) {
|
||||
case 0:
|
||||
case 0:
|
||||
*out++ = v;
|
||||
*out++ = ut;
|
||||
*out++ = up;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*out++ = uq;
|
||||
*out++ = v;
|
||||
*out++ = up;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
*out++ = up;
|
||||
*out++ = v;
|
||||
*out++ = ut;
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
*out++ = up;
|
||||
*out++ = uq;
|
||||
*out++ = v;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
*out++ = ut;
|
||||
*out++ = up;
|
||||
*out++ = v;
|
||||
break;
|
||||
case 5:
|
||||
case 5:
|
||||
*out++ = v;
|
||||
*out++ = up;
|
||||
*out++ = uq;
|
||||
|
@ -418,7 +418,7 @@ rgba2rgba(UINT8* out, const UINT8* in, int xsize)
|
|||
}
|
||||
}
|
||||
|
||||
/* RGBa -> RGBA conversion to remove premultiplication
|
||||
/* RGBa -> RGBA conversion to remove premultiplication
|
||||
Needed for correct transforms/resizing on RGBA images */
|
||||
static void
|
||||
rgba2rgbA(UINT8* out, const UINT8* in, int xsize)
|
||||
|
@ -442,13 +442,13 @@ rgba2rgbA(UINT8* out, const UINT8* in, int xsize)
|
|||
}
|
||||
|
||||
/*
|
||||
* Conversion of RGB + single transparent color to RGBA,
|
||||
* where any pixel that matches the color will have the
|
||||
* Conversion of RGB + single transparent color to RGBA,
|
||||
* where any pixel that matches the color will have the
|
||||
* alpha channel set to 0
|
||||
*/
|
||||
|
||||
static void
|
||||
rgbT2rgba(UINT8* out, int xsize, int r, int g, int b)
|
||||
rgbT2rgba(UINT8* out, int xsize, int r, int g, int b)
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
UINT32 trns = ((r & 0xff)<<24) | ((g & 0xff)<<16) | ((b & 0xff)<<8) | 0xff;
|
||||
|
@ -1334,8 +1334,8 @@ ImagingConvertTransparent(Imaging imIn, const char *mode,
|
|||
return (Imaging) ImagingError_ModeError();
|
||||
}
|
||||
|
||||
if (!((strcmp(imIn->mode, "RGB") == 0 ||
|
||||
strcmp(imIn->mode, "L") == 0)
|
||||
if (!((strcmp(imIn->mode, "RGB") == 0 ||
|
||||
strcmp(imIn->mode, "L") == 0)
|
||||
&& strcmp(mode, "RGBA") == 0))
|
||||
#ifdef notdef
|
||||
{
|
||||
|
@ -1370,7 +1370,7 @@ ImagingConvertTransparent(Imaging imIn, const char *mode,
|
|||
}
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
return imOut;
|
||||
return imOut;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ ImagingIncrementalCodecCreate(ImagingIncrementalCodecEntry codec_entry,
|
|||
codec->state = state;
|
||||
codec->result = 0;
|
||||
codec->stream.fd = fd;
|
||||
codec->stream.buffer = codec->stream.ptr = codec->stream.end
|
||||
codec->stream.buffer = codec->stream.ptr = codec->stream.end
|
||||
= codec->stream.top = NULL;
|
||||
codec->started = 0;
|
||||
codec->seekable = seekable;
|
||||
|
@ -294,7 +294,7 @@ ImagingIncrementalCodecDestroy(ImagingIncrementalCodec codec)
|
|||
if (codec->seekable && codec->stream.fd < 0)
|
||||
free (codec->stream.buffer);
|
||||
|
||||
codec->stream.buffer = codec->stream.ptr = codec->stream.end
|
||||
codec->stream.buffer = codec->stream.ptr = codec->stream.end
|
||||
= codec->stream.top = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -68,7 +68,7 @@ j2k_skip(OPJ_OFF_T p_nb_bytes, void *p_user_data)
|
|||
|
||||
typedef void (*j2k_unpacker_t)(opj_image_t *in,
|
||||
const JPEG2KTILEINFO *tileInfo,
|
||||
const UINT8 *data,
|
||||
const UINT8 *data,
|
||||
Imaging im);
|
||||
|
||||
struct j2k_decode_unpacker {
|
||||
|
@ -625,7 +625,7 @@ j2k_decode_entry(Imaging im, ImagingCodecState state,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Colorspace Number of components PIL mode
|
||||
------------------------------------------------------
|
||||
sRGB 3 RGB
|
||||
|
@ -668,7 +668,7 @@ j2k_decode_entry(Imaging im, ImagingCodecState state,
|
|||
if (!unpack) {
|
||||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
state->state = J2K_STATE_FAILED;
|
||||
goto quick_exit;
|
||||
goto quick_exit;
|
||||
}
|
||||
|
||||
/* Decode the image tile-by-tile; this means we only need use as much
|
||||
|
|
|
@ -303,7 +303,7 @@ j2k_encode_entry(Imaging im, ImagingCodecState state,
|
|||
prec = 16;
|
||||
bpp = 12;
|
||||
} else if (strcmp (im->mode, "LA") == 0) {
|
||||
components = 2;
|
||||
components = 2;
|
||||
color_space = OPJ_CLRSPC_GRAY;
|
||||
pack = j2k_pack_la;
|
||||
} else if (strcmp (im->mode, "RGB") == 0) {
|
||||
|
@ -544,8 +544,8 @@ ImagingJpeg2KEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes)
|
|||
return -1;
|
||||
|
||||
if (state->state == J2K_STATE_START) {
|
||||
int seekable = (context->format != OPJ_CODEC_J2K
|
||||
? INCREMENTAL_CODEC_SEEKABLE
|
||||
int seekable = (context->format != OPJ_CODEC_J2K
|
||||
? INCREMENTAL_CODEC_SEEKABLE
|
||||
: INCREMENTAL_CODEC_NOT_SEEKABLE);
|
||||
|
||||
context->encoder = ImagingIncrementalCodecCreate(j2k_encode_entry,
|
||||
|
|
|
@ -300,7 +300,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
if (context->qtables) {
|
||||
free(context->qtables);
|
||||
context->qtables = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
jpeg_destroy_compress(&context->cinfo);
|
||||
/* if (jerr.pub.num_warnings) return BROKEN; */
|
||||
|
|
|
@ -400,7 +400,7 @@ ImagingPackLAB(UINT8* out, const UINT8* in, int pixels)
|
|||
/* LAB triplets */
|
||||
for (i = 0; i < pixels; i++) {
|
||||
out[0] = in[0];
|
||||
out[1] = in[1] ^ 128; /* signed in outside world */
|
||||
out[1] = in[1] ^ 128; /* signed in outside world */
|
||||
out[2] = in[2] ^ 128;
|
||||
out += 3; in += 4;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
int stride = state->bytes / bands;
|
||||
int i;
|
||||
for (i=1; i< bands; i++) { // note -- skipping first band
|
||||
memmove(&state->buffer[i*state->xsize],
|
||||
&state->buffer[i*stride],
|
||||
memmove(&state->buffer[i*state->xsize],
|
||||
&state->buffer[i*stride],
|
||||
state->xsize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,10 +94,10 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
while (state->x < planes * bytes_per_line) {
|
||||
/* If we're encoding an odd width file, and we've
|
||||
got more than one plane, we need to pad each
|
||||
color row with padding bytes at the end. Since
|
||||
color row with padding bytes at the end. Since
|
||||
The pixels are stored RRRRRGGGGGBBBBB, so we need
|
||||
to have the padding be RRRRRPGGGGGPBBBBBP. Hence
|
||||
the double loop
|
||||
to have the padding be RRRRRPGGGGGPBBBBBP. Hence
|
||||
the double loop
|
||||
*/
|
||||
while (state->x % bytes_per_line) {
|
||||
|
||||
|
@ -174,8 +174,8 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
}
|
||||
/* reset for the next color plane. */
|
||||
if (state->x < planes * bytes_per_line) {
|
||||
state->count = 1;
|
||||
state->LAST = state->buffer[state->x];
|
||||
state->count = 1;
|
||||
state->LAST = state->buffer[state->x];
|
||||
state->x++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -758,13 +758,13 @@ unpackCMYKI(UINT8* out, const UINT8* in, int pixels)
|
|||
/* Unpack to "LAB" image */
|
||||
/* There are two representations of LAB images for whatever precision:
|
||||
L: Uint (in PS, it's 0-100)
|
||||
A: Int (in ps, -128 .. 128, or elsewhere 0..255, with 128 as middle.
|
||||
Channels in PS display a 0 value as middle grey,
|
||||
A: Int (in ps, -128 .. 128, or elsewhere 0..255, with 128 as middle.
|
||||
Channels in PS display a 0 value as middle grey,
|
||||
LCMS appears to use 128 as the 0 value for these channels)
|
||||
B: Int (as above)
|
||||
B: Int (as above)
|
||||
|
||||
Since we don't have any signed ints, we're going with the shifted versions
|
||||
internally, and we'll unshift for saving and whatnot.
|
||||
Since we don't have any signed ints, we're going with the shifted versions
|
||||
internally, and we'll unshift for saving and whatnot.
|
||||
*/
|
||||
void
|
||||
ImagingUnpackLAB(UINT8* out, const UINT8* in, int pixels)
|
||||
|
@ -802,15 +802,15 @@ unpackI16N_I16(UINT8* out, const UINT8* in, int pixels){
|
|||
|
||||
static void
|
||||
unpackI12_I16(UINT8* out, const UINT8* in, int pixels){
|
||||
/* Fillorder 1/MSB -> LittleEndian, for 12bit integer greyscale tiffs.
|
||||
/* Fillorder 1/MSB -> LittleEndian, for 12bit integer greyscale tiffs.
|
||||
|
||||
According to the TIFF spec:
|
||||
According to the TIFF spec:
|
||||
|
||||
FillOrder = 2 should be used only when BitsPerSample = 1 and
|
||||
the data is either uncompressed or compressed using CCITT 1D
|
||||
or 2D compression, to avoid potentially ambiguous situations.
|
||||
|
||||
Yeah. I thought so. We'll see how well people read the spec.
|
||||
Yeah. I thought so. We'll see how well people read the spec.
|
||||
We've got several fillorder=2 modes in TiffImagePlugin.py
|
||||
|
||||
There's no spec I can find. It appears that the in storage
|
||||
|
|
Loading…
Reference in New Issue
Block a user