[Django] #32084: Can't upload PNG to ImageField

13 views
Skip to first unread message

Django

unread,
Oct 7, 2020, 6:24:44 PM10/7/20
to django-...@googlegroups.com
#32084: Can't upload PNG to ImageField
-----------------------------------------+------------------------
Reporter: terminator14 | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I have an image field like this:

{{{
logo_help_text = "Company Logo"
logo = models.ImageField(upload_to='logos/', blank=True, null=True,
help_text=logo_help_text)
}}}

I can upload lots of different images, in Django Admin to this field
without issue. The particular image I was trying to upload had no problems
being uploaded, but the image contained a logo with dark letters, and my
website background color was dark, so it looked bad. All I did was use
Gimp 2.10.4 (MacOS) to change the color of the company name text in the
logo to a lighter color, and export the PNG.

According to linux's 'file' tool, both the source logo, and the resulting
logo are identified exactly the same:

{{{
test.png: PNG image data, 1280 x 403, 8-bit/color RGBA, non-interlaced
}}}


For some reason, when I try to upload the resulting PNG, Django admin
tells me "Upload a valid image. The file you uploaded was either not an
image or a corrupted image.".

Image file that can't be uploaded attached.

--
Ticket URL: <https://code.djangoproject.com/ticket/32084>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 7, 2020, 6:25:31 PM10/7/20
to django-...@googlegroups.com
#32084: Can't upload PNG to ImageField
-------------------------------+--------------------------------------

Reporter: terminator14 | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by terminator14):

* Attachment "test.png" added.

Image that can't be uploaded to ImageField

Django

unread,
Oct 7, 2020, 6:27:06 PM10/7/20
to django-...@googlegroups.com
#32084: Can't upload PNG to ImageField
-------------------------------+--------------------------------------

Reporter: terminator14 | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by terminator14:

Old description:

> I have an image field like this:
>
> {{{
> logo_help_text = "Company Logo"
> logo = models.ImageField(upload_to='logos/', blank=True, null=True,
> help_text=logo_help_text)
> }}}
>
> I can upload lots of different images, in Django Admin to this field
> without issue. The particular image I was trying to upload had no
> problems being uploaded, but the image contained a logo with dark
> letters, and my website background color was dark, so it looked bad. All
> I did was use Gimp 2.10.4 (MacOS) to change the color of the company name
> text in the logo to a lighter color, and export the PNG.
>
> According to linux's 'file' tool, both the source logo, and the resulting
> logo are identified exactly the same:
>
> {{{
> test.png: PNG image data, 1280 x 403, 8-bit/color RGBA, non-interlaced
> }}}
>

> For some reason, when I try to upload the resulting PNG, Django admin
> tells me "Upload a valid image. The file you uploaded was either not an
> image or a corrupted image.".
>
> Image file that can't be uploaded attached.

New description:

I have an image field like this:

{{{
logo_help_text = "Company Logo"
logo = models.ImageField(upload_to='logos/', blank=True, null=True,
help_text=logo_help_text)
}}}

I can upload lots of different images, in Django Admin to this field
without issue. The particular image I was trying to upload had no problems
being uploaded, but the image contained a logo with dark letters, and my
website background color was dark, so it looked bad. All I did was use
Gimp 2.10.4 (MacOS) to change the color of the company name text in the
logo to a lighter color, and export the PNG.

According to MacOS' 'file' tool, both the source logo, and the resulting


logo are identified exactly the same:

{{{
test.png: PNG image data, 1280 x 403, 8-bit/color RGBA, non-interlaced
}}}


For some reason, when I try to upload the resulting PNG, Django admin
tells me "Upload a valid image. The file you uploaded was either not an
image or a corrupted image.".

Image file that can't be uploaded attached.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32084#comment:1>

Reply all
Reply to author
Forward
0 new messages