Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Zaki Shaheen
    @zakishaheen
    @radarhere 3DLUT is mind-blowing fast. So basically for my usecase, it is 55X faster than getpixel etc. and 15X faster than numpy based approach I was using.
    can't wait for it to get released in 5.2 :)
    @homm great work on pillow-lut-tools. Have a few ideas to improve the file loading/etc. I'll try to do a pull-request soon when I get time.
    Alexander Karpinsky
    @homm
    Thanks ) I still think that the point method could be fister for your case, because you don't nedd 3D LUT, you only need three 1D LUT, which "point" is.
    Zaki Shaheen
    @zakishaheen
    @homm actually, 3DLUT works because in my pipeline, its easier for artist to export a .cube file from photoshop at 'low' quality and then I just call that function. The artist then has the flexibility. We're essentially taking a grayscale image and passing it thru different .cube files to get a rendered image (think drawing a grayscale body and having a .cube file for the different skin tones - can shade a cartoon asset in different skin tones).
    Alex Clark
    @aclark4life
    Yay people using gitter
    Konstantin Kopachev
    @kkopachev
    @homm could you clarify how RGBX rawmode read helps with performance in jpeg decoder? python-pillow/Pillow#1989
    Isn't it end up shuffling same way to RGB? RGB->RGB and RGBX->RGB unpackers are same, so how speedup is achieved?
    internetfan420
    @internetfan420
    anyone around that could help with writing the whole of a text file instead of just a string
    Andrew Murray
    @radarhere

    Hi. I don't quite understand your question. However, I will attempt to answer.

    To read an entire file in Python -

    with open('in.txt', 'r') as f:
    data = f.read()

    To write that data back to a file -

    with open('out.txt', 'w') as f:
    f.write(data)

    If you are having trouble because your data is bytes, not a string -

    with open('out.txt', 'wb') as f:
    f.write(data)

    Also, if your question relates to Pillow in some way, please explain further, because I don't see it.

    Zaki Shaheen
    @zakishaheen
    @homm in my production system, pillow-lut gets built as a wheel. I want to be able to bring in the tests too....do you have plans to incldue that in setup.py setup.cfg?
    Alexander Karpinsky
    @homm
    @kkopachev Internally in Pillow RGB and RGBX are the same modes. But for libjpeg RGB is true RGB, where each pixel consists of 3 bytes. So RGB (libjpeg) → RGB (Pillow) convertion is costly operation, while RGBX (libjpeg) → RGB (Pillow) is just copying.
    @zakishaheen Sorry, I don't understend what do you want. setup.cfg is automaticaly generated, I even never open it and don't know what it contains )
    VisualCoder
    @VisualTuber_gitlab
    hello, is this a place where i can ask for help about an issue i'm having with pillow?
    Andrew Murray
    @radarhere
    Yes, it is, although I’m guessing that you’ve since already asked your question on GitHub
    VisualCoder
    @VisualTuber_gitlab
    yes and it has been resolved
    kurwazavr
    @kurwazavr
    hello everyone
    is there a way one can map one image over other by uv map?
    that is, I have a uv map, and I transform a given image according to it
    Andrew Murray
    @radarhere

    When you say UV map, you’re talking about Blender, yes? Are you sure this is a Pillow question, and not a Blender question?

    A bit of Googling, and https://blender.stackexchange.com/questions/7855/how-can-i-set-the-image-to-use-the-uv-map-using-the-python-api seems interesting.

    James Albert
    @jamesalbert
    Has anybody had the problem, when taking multiple cropped frames from a transparent png in order to save them as a gif, that the previous frames get tacked onto future ones?
    sprite.gif
    currently getting this ^, I can post code if needed, but I .show() each frame and none of them show this blend of frames.
    But my save looks like: snaps[0].save('build/sprite.gif', transparency=0, save_all=True, append_images=snaps[1:], loop=0)
    Andrew Murray
    @radarhere
    There are similar issues when starting with GIF images, but I’m surprised that you’re experiencing this starting with a PNG. The original image would be most helpful if you’d like this looked at a bit more.
    James Albert
    @jamesalbert
    Yeah np, got it right here
    walking-sprite.png
    as for the code, I'm just iterating over a list of quadrants, cropping them, then saving them. I'll get a snippet going here in a sec...
    James Albert
    @jamesalbert
    snaps = list()
    for q in quadrants:
        crop = image.crop(q)
        alpha = crop.getchannel('A')
        mask = Image.eval(alpha, lambda a: 255 if a <= 128 else 0)
        crop.paste(0, mask)
        crop.info['transparency'] = 255
        snaps.append(crop)
    snaps[0].save('build/sprite.gif', transparency=0, save_all=True, append_images=snaps[1:], loop=0)
    there we go (more or less), I've been experimenting with a couple different ways, none of which have worked
    James Albert
    @jamesalbert

    I also played around with:

    bg = Image.new('RGBA', crop.size, (255, 255, 255, 255))
    bg.paste(crop, alpha)
    crop = bg.convert('RGB').convert('P', palette=Image.ADAPTIVE)

    but same issue

    Andrew Murray
    @radarhere
    Okay, I was able to get your code working using ‘disposal’
    from PIL import Image
    image = Image.open('walking-sprite.png')
    snaps = []
    for i in range(0, 8):
        crop = image.crop((i * 28, 111-28, (i+1)*28, 111))
        alpha = crop.getchannel('A')
        mask = Image.eval(alpha, lambda a: 255 if a <= 128 else 0)
        crop.paste(0, mask)
        crop.info['transparency'] = 255
        snaps.append(crop)
    snaps[0].save('sprite.gif', transparency=0, save_all=True, append_images=snaps[1:], loop=0, disposal=2)
    James Albert
    @jamesalbert
    Nice @radarhere thanks a lot! After looking up what disposal is, I can see why that'd be the case :+1:
    Daniel Albuschat
    @daniel-kun
    Hello there! I'd like to add a function to Image (or some other place?) to automatically rotate an image according to it's EXIF Orientation tag, and remove that tag thereafter. Do you have interest in this?
    Andrew Murray
    @radarhere
    Sounds like a good idea to me. Feel free to create a PR
    Jeremy Moore
    @photosbyjeremy
    I need the ability to save bitonal files with a Photometric Interpretation (TIffTag 262) of 0, which is white-is-min. This is a requirement for the HathiTrust book preservation project. This is my first time trying to assist/work on someone else's project so I'm not sure exactly how to do that part of things
    In the TiffImagePlugin.py, I added this option and don't know if it would be of use to others
    alt
    alt
    Andrew Murray
    @radarhere
    Hi. The images that you’ve attached aren’t working, so I can’t comment on that. You could also create an issue at https://github.com/python-pillow/Pillow/issues and upload the images there if you want to talk about it further. Or you could try and create a pull request with your suggested code changes at https://github.com/python-pillow/Pillow/pulls
    From your description, it sounds like you’re trying to save custom tiff tags. What version of Pillow are you using? You may find that updating to the latest Pillow gives you the feature you’re after - https://pillow.readthedocs.io/en/stable/releasenotes/5.4.0.html#new-custom-tiff-tags
    Jeremy Moore
    @photosbyjeremy
    sorry, I didn't realize I was linking the images incorrectly, this link
    should hopefully work
    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