Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jeremy Moore
    @photosbyjeremy
    I'm on the newest version of Pillow. The problem is that Photometric Interpretation seems to be hard-coded when you're saving the image, but I'm trying out using the a custom tag
    I'd just tried using tiffinfo = {262: 0} before, but I think that wasn't the correct value to pass as it doesn't work with the code I linked either. I think it needs to be (0, ) and NOT 0 tiffinfo = {262:(0,)} like my linked code needs (just replacing ifd directly while saving)
    Jeremy Moore
    @photosbyjeremy
    Is the problem that Photometric Interpretation isn't a custom tag?
    I'll upload this as an issue to GitHub
    Martin Malmsten
    @marma
    Hi. I'm using PIL to serve images using the IIIF protocol and have a performance question. Has there been any work done, or interest shown, in partial decoding of JPEG2000-images? There are two things that speed up the decompression of an image a lot when using opj_decompress: (1) reducing the size by a power of two and (2) cropping. This is useful when creating tiles and/or thumbnails on the fly from large image collections, i.e when you don't want to create and save a huge number of pre-scaled/cropped tiles and sizes. As far as I can tell you can set Jpeg2KImageFile.reduce to decrease the final size which will result in faster decode time, but there is no way to decode only the cropped region. Am I correct, or his there any way to tell PIL to tell OpenJPEG to do partial decoding?
    Ivan
    @advancedwebdeveloper
    Hello
    I wonder if there are any attempts to adopt your lib for accessing from the side of Autodesk's Python SDK/for an integration purpose
    looks like your lib is itself is a replacement for the relict one, which it is still referencing
    plus I wonder about the language version - products' versions for 2014 relly on Python 2.x, not 3.x
    ...who is coming to the PyCon Ukraine 2019?
    Andrew Murray
    @radarhere
    Pillow currently works with both Python 2 and 3. However, at the start of 2020, Pillow 7.0.0 will drop support for Python 2. See https://pythonclock.org/ and https://python3statement.org/
    Ivan
    @advancedwebdeveloper

    Pillow currently works with both Python 2 and 3. However, at the start of 2020, Pillow 7.0.0 will drop support for Python 2. See https://pythonclock.org/ and https://python3statement.org/

    It does not seam that Autodesk switched their Python SDK to Python 3.x. At least - not for their current releases of their products

    Andrew
    @apullin
    Is there a build artifact for windows for 6.1.0.x ? I am up against bug #3772, in a Windows environment. On a separate machine under OSX, I was easily able to build from source, but I would like it to work on this desktop PC (compute machine w/ GPU).
    Andrew
    @apullin
    Or if someone already has a Windows/Python 3.7 build environment set up and known working (I can't get it to work here), and could build 6.1.0.dev0 for my and give me the egg, that would be super useful.
    Andrew Murray
    @radarhere
    Pillow uses AppVeyor for testing, and eggs artifacts are created as part of that process. So, here are the artifacts for Windows Python 3.7 from one merge after the #3772 fix
    Be aware that the environment used to create those was not set up with LCMS2, RAQM or libimagequant.
    Andrew
    @apullin
    @radarhere Thanks, that worked for me!
    Ajay Tripathi
    @atb00ker
    Hello, I am using alpine linux and I need zlib-dev and jpeg-dev before doing pip install pillow
    I am trying to figure out if these libraries are build dependencies or required for usage as well because everything seems to work right now but I am ensuring nothing will break in future. :-)
    Andrew Murray
    @radarhere
    Bruce Elbert Bigirwenkya
    @Elbertbiggs360
    Hi. Can anyone here point point me to a reference about resolving the underlying issues from ghostscript about multiple -dSAFER sandbox bypass vulnerabilities
    Andrew Murray
    @radarhere
    There are a number of SAFER fixes in Ghostscript 9.26 - https://www.ghostscript.com/doc/9.26/History9.htm#Version9.26. Does that not address your concerns?
    Bruce Elbert Bigirwenkya
    @Elbertbiggs360
    @radarhere I believe it should. Thanks :slight_smile:
    Bruce Elbert Bigirwenkya
    @Elbertbiggs360
    I am new to the library. Can you help point me to anything that details how ghostscript as a dependency is installed
    Andrew Murray
    @radarhere
    Ghostscript is actually not integrated into Pillow through any kind of C calls - Pillow just uses Ghostscript by making command line 'gs' calls (or ‘gswin32c' or ‘gswin64c' as the case may be). So regardless of whether you already have Pillow installed or not, you just need to ensure that Ghostscript is installed on your system - no special instructions necessary.

    Or are you just asking how to install Ghostscript at all? If so, what operating system are you using?

    https://www.ghostscript.com/download/gsdnld.html

    Bruce Elbert Bigirwenkya
    @Elbertbiggs360
    I have Debian GNU/Linux instance on GCP. Let me check up on the shared link :slight_smile:
    Bruce Elbert Bigirwenkya
    @Elbertbiggs360
    Ok so the instance has v9.26 of GS which should be secure enough. I'll merely upgrade the version of Pillow I'm using to the latest and pick up from there
    Dominic Bou-Samra
    @dbousamra
    I'm trying to get Pillow to use libjpeg-turbo on ubuntu 18.04. What packages do I need? And how do I tell pillow to use it? features.get_supported_features() is showing it's not enabled
    Dominic Bou-Samra
    @dbousamra
    nvm, found this: python-pillow/Pillow#3986
    Andrew Murray
    @radarhere
    Wei Jiang
    @jiangwei221
    Hi, I have a depth image whch is float32, and how can I resize it using PIL? What is the correct way to convert a 2D float32 array to a PIL Image object? Thank you!
    Andrew Murray
    @radarhere

    If you have an image file, I would try -

    from PIL import Image
    im = Image.open('image.tif')
    new_im = im.resize((100, 100))

    If by '2d float32 array' you are referring to a numpy array -

    from PIL import Image
    im = Image.fromarray(x)

    Wei Jiang
    @jiangwei221
    Ah, I see, thanks! I was confused because when I use matplotlib to display the PIL.Image object, it gives me a 4 channel uint8 image. But if I do plt.imshow(np.array(a)), it works perfectly.
    Code:
    depth_map is a 2d float32 np array
    a = Image.fromarray(depth_map, mode='F')
    plt.imshow(a) # gives me a 4 channel uint8 image
    plt.imshow(np.array(a)) # gives the correct visualization
    tkzv
    @tkzv
    Hello. What is the right way to paste images, that start at negative coordinates and use alpha channel? PIL.Image.alpha_composite doesn't accept negative coordinates, and I couldn't figure out how to use PIL.Image.paste with a mask -- it adds the new image under the original one.
    Andrew Murray
    @radarhere
    Here is how I would use paste to do that -
    from PIL import Image
    im_base = Image.open("Tests/images/hopper.jpg")
    im_overlay = Image.open("Tests/images/transparent.png")
    im_base.paste(im_overlay, (-50, -50), im_overlay)
    im_base.save('out.png')
    tkzv
    @tkzv
    I tried that and it didn't look right. But the problem was in the images. Thanks.
    Technerder
    @Technerder
    I'm running into an issue while trying to overlay text over a gif stored in a BytesIO object
                        edited_image_bytes = BytesIO()
                        image = Image.open(BytesIO(await request.read()))
                        frames = []
                        for frame in ImageSequence.Iterator(image):
                            d = ImageDraw.Draw(frame)
                            d.text((10, 100), "Hello World")
                            del d
                            b = BytesIO()
                            frame.save(b, format="GIF")
                            frames.append(Image.open(b))
                        frames[0].save(edited_image_bytes, format='GIF', save_all=True, append_images=frames[1:])
    The file is empty
    Andrew Tolmie
    @DancingQuanta
    Hi, have anyone seeing DLL not found error when piliow is install via conda-forge as dependency of matplotlib or bokeh?
    Andrew Murray
    @radarhere
    I think you’ll be interested in conda-forge/pillow-feedstock#45 and python-pillow/Pillow#4155
    Andrew Tolmie
    @DancingQuanta
    Thanks, I have commented on the recently opened issue conda-forge/pillow-feedstock#66
    Michael Adam Cabatingan
    @Peaceful-Whale
    I am trying to use Pillow with eclipse, but I keep getting this error:
    from PIL import Image
    ImportError: No module named 'PIL'
    I have PIL specified in the external library thing
    Project > Properties > PYDEV - PYTHONPATH
    I have it pointed to the folder I extracted from the download on the Pillow website
    Do I need to point to Pillow - 7.0.0 or PIL in the scr folder of Pillow - 7.0.0
    Michael Adam Cabatingan
    @Peaceful-Whale
    I get the same error if I just delete that reference
    attempting to copy just the PIL folder and use that changes nothing
    I think if I do that and restart I get a different error though
    In the "project references" it shows that it is indeed referencing PIL