Giter VIP home page Giter VIP logo

Comments (4)

pharmapsychotic avatar pharmapsychotic commented on June 7, 2024 3

Thanks @0xdevalias and @ProGamerGov !! Fix has been applied now 👍

from clip-interrogator.

spro avatar spro commented on June 7, 2024 1

I ran into the same problem with PNGs that had alpha channels - you can remove the alpha channel with imagemagick:

convert input.png -alpha off output.png

from clip-interrogator.

0xdevalias avatar 0xdevalias commented on June 7, 2024

This is the section of code that handles the image stuff, if you provide a URL it uses .convert('RGB'), but if you upload the file directly it doesn't:

" image_url = image_txt.value\n",
" if len(uploader.value):\n",
" print(uploader.value)\n",
" print(uploader.value.items())\n",
" for name, file_info in uploader.value.items():\n",
" image = Image.open(io.BytesIO(file_info['content']))\n",
" break\n",
" else:\n",
" if str(image_url).startswith('http://') or str(image_url).startswith('https://'):\n",
" image = Image.open(requests.get(image_url, stream=True).raw).convert('RGB')\n",
" else:\n",
" image = Image.open(image_url).convert('RGB')\n",

By changing this line:

image = Image.open(io.BytesIO(file_info['content']))\n",

to

image = Image.open(io.BytesIO(file_info['content'])).convert('RGB')\n",

It should automatically convert the image to remove the alpha channel.

(Answer found on this StackOverflow answer)

from clip-interrogator.

pharmapsychotic avatar pharmapsychotic commented on June 7, 2024

Thanks, I'll test and fix now

from clip-interrogator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.