- «ValueError: bad transparency mask» when pasting one image onto another with Python Imaging Library?
- Related Query
- More Query from same tag
- Saved searches
- Use saved searches to filter your results more quickly
- «bad transparency mask» error when upscale=False #270
- «bad transparency mask» error when upscale=False #270
- Comments
«ValueError: bad transparency mask» when pasting one image onto another with Python Imaging Library?
Late to the game here, but I just ran into the same issue. After some googling I was able to get my mask to work by making sure all of the images being used were the same mode (specifically «RGBA»).
card = Image.new("RGBA", (220, 220), (255, 255, 255)) img = Image.open("/Users/paulvorobyev/test.png").convert("RGBA") x, y = img.size card.paste(img, (0, 0, x, y), img) card.save("test.png", format="png")
Related Query
- Copying one image onto another with PIL
- get ValueError: bad transparency mask when trying to paste, image and mask are the same
- PIL: pasting an image onto another image, calculate position
- How to automatically detect a specific feature from one image and map it to another mask image? Then how to smoothen only the corners of the image?
- How do I pass one C++ class (reference) to another when using Cython?
- How to modify pydantic field when another one is changed?
- Compare a list of lists with another list, and return common one
- Changing a value in one list changes the values in another list with a different memory ID
- PIL smudges image when I overlay another image on it
- OpenCV python copy polygon from one image to another
- Matplotlib — savefig ignores facecolor when saving with transparency
- itertools.islice raise a ValueError when used with functools.partial
- When does python stop on a line in tracing with more than one stopping point on a line?
- append contents from one file to another with newline separation
- TypeError when resizing an image with PIL in Python
- Copying and Writing EXIF information from one image to another using pyexiv2
- Testdriven.io: Test-Driven Development with FastAPI and Docker Error when running Github Action Test Docker Image
- Mask Issue With Python OpenCV ORB Image Alignment
- Copy spreadsheet sheet to a another one with Google API using Python
- How to print out only records with intervals, from one file, not overlapping with those from another file
- Is it possible to create a mutually exclusive group inside another one with argparse (Python)?
- Is it possible to join two charts, one plotted with matplotlib.pyplot and the other plotted with mplfinance into the same figure. eg; same image
- How to update one element of a csv with information from another csv?
- Change style in one Matplotlib Figure when working with several Figures simultaneously
- Image does not show in header when opened with LibreOffice
- opencv python copy mask region (black or white pixels) onto a BGR image region
- Python 3.4 crashes when opening an image with PIL in tkinter
- How to adjust size of two subplots, one with colorbar and another without, in pyplot ?
- How to replace one element from a list with several element from another list?
- Create copy of plone installed onto another server with data
- How to paste a small image on another big image at center in python with an image processed with OpenCV?
- Animating one image on top of another in matplotlib
- How to replace contents of column in one file with that of another file based on key variable?
- IndexError when trying to save an image with PIL
- Python (PIL): Lighten transparent image and paste to another one
- Image Processing: Bad Quality of Disparity Image with OpenCV
- Checking closeness of coordinates in one group with another
- How to make two dataframes one with values and another with boolean into one dataframe in python?
- Avoid duplicate name when importing a sub-module with only one public member from a package
- How to elegantly replace certain characters in one string with characters in another at the same index?
- Replacing one number with another in PYTHON
- Algorithm for detecting edge of shape in image with PIL in python when separation < 1 px
- Python wand: composite image with transparency
- Fabric : connect to machine with one user then do stuff with another
- Copying and Pasting from one Google Sheet to another
- How to soup particular div class when there is another with similar one?
- What causes the error ‘unknown option «pyimage1″‘ while I’m trying to load image onto canvas with tkinter?
- Different python versions when exec and when building image with singularity, the same official python docker image
- Pasting image with Alpha transpency
- Updating a yaml file with the contents of another one
More Query from same tag
- Is there a way to write the errors given in corner plots
- Check number not a sum of 2 ints on a list
- Break bytes object into n equally sized blocks based on index
- Trying to understand the pythonpath variable
- subprocess.call not working in PyCharm (linux)
- Have QGraphicsItem receive ALL mouse moves?
- Python low-level vs high-level performance (running time analysis of palindrome functions)
- Behavior of python method in absence of return statement
- Removing non ASCII from corpus
- How to overlay a scatterplot on top of boxplot with sns.catplot?
- List-append in Python with multi-threading (using concurrent.futures) results in offset rows
- matplotlib: ugly plots when using markers
- Cloud online prediction returns request payload size exceeds the limit: 1572864 bytes
- Clean .txt and count most frequent words
- Celery periodic_task running multiple times in parallel
- Py2exe with Tkinter
- Can I use the free Microsoft C++ Compiler for Python 2.7 to build conda packages?
- Construct tree given root
- How can Python compare strings with integers?
- AJAX and Python Error — No ‘Access-Control-Allow-Origin’ header is present on the requested resource
- Running code with another interpreter on a Perl script
- Python- Wireless Controller & List of Addends/Values
- Python imports: importing a module without .py extension?
- Python Tkinter — How to make certain code use less memory
- Working with lists in PHP
- Nestable timeout decorator? (i.e. timeout decorated func calling timeout decorated func)
- How to find/detect if a build-in function is used in Python AST?
- Python remove elements from two dimensional list
- How to except SyntaxError?
- Python, Cygwin — ImportError: No module named _psycopg
- Sphinx autodoc and multi-line strings
- Determining if a MIME email part is a file or message text
- Setting function variables with execfile()
- How to use the Class decorator wrapper?
- why OR returns True if the first element is True, but ANY still checks all element even if the first element is True
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
«bad transparency mask» error when upscale=False #270
«bad transparency mask» error when upscale=False #270
Comments
I get a «bad transparency mask» error when converting a GIF to a JPEG, but only when upscale is set to False . Oddly enough, the error does not occur when upscaling is permitted.
Is there a recommended workaround?
Here is the model definition:
class PhotoModel(models.Model): large = ImageSpecField(source='image_file', processors=[Transpose(), ResizeToFit(width=500, height=400, upscale=False)], format='JPEG', options=)
Traceback (most recent call last): File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/django/db/transaction.py", line 339, in inner return func(*args, **kwargs) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view return self.dispatch(request, *args, **kwargs) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch return handler(request, *args, **kwargs) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/django/views/generic/edit.py", line 171, in post return self.form_valid(form) File "/Users/alexington/sites/project_github/project/core/photos/views.py", line 16, in form_valid 'previewUrlLarge': photo.large.url, File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/__init__.py", line 84, in url return self._storage_attr('url') File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/__init__.py", line 74, in _storage_attr existence_required.send(sender=self, file=self) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send response = receiver(signal=self, sender=sender, **named) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/registry.py", line 53, in existence_required_receiver self._receive(file, 'on_existence_required') File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/registry.py", line 61, in _receive call_strategy_method(file, callback) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/utils.py", line 140, in call_strategy_method fn(file) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/strategies.py", line 15, in on_existence_required file.generate() File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/__init__.py", line 93, in generate self.cachefile_backend.generate(self, force) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/backends.py", line 108, in generate self.generate_now(file, force=force) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/backends.py", line 96, in generate_now file._generate() File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/cachefiles/__init__.py", line 97, in _generate content = generate(self.generator) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/utils.py", line 123, in generate content = generator.generate() File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/imagekit/specs/__init__.py", line 158, in generate options=self.options) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/pilkit/utils.py", line 350, in process_image return img_to_fobj(img, format, autoconvert, **options) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/pilkit/utils.py", line 17, in img_to_fobj return save_image(img, StringIO(), format, options, autoconvert) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/pilkit/utils.py", line 177, in save_image img, save_kwargs = prepare_image(img, format) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/pilkit/utils.py", line 332, in prepare_image img = MakeOpaque().process(img).convert('RGB') File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/pilkit/processors/base.py", line 223, in process new_img.paste(img, img) File "/Users/alexington/.virtualenvs/project/lib/python2.7/site-packages/PIL/Image.py", line 1118, in paste self.im.paste(im, box, mask.im) ValueError: bad transparency mask
The text was updated successfully, but these errors were encountered: