google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Resizing PNG images #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Upload some PNG
2. Try to display it in some of the PhotoSize

What is the expected output? What do you see instead?
You should see resized image. Instead of it you see nothing (resized image
in cache dir have only 8 bytes).

What version of the product are you using? On what operating system?
Latest version; FreeBsd 5.4

Please provide any additional information below.
You must repair lines 206 and 207 in file models.py:

box = (x_diff, y_diff, int(x-x_diff), int(y-y_diff))
resized = im.resize((int(x), int(y)), Image.ANTIALIAS).crop(box)

Original issue reported on code.google.com by maly.bzy...@gmail.com on 18 Oct 2007 at 12:03

Attachments:

GoogleCodeExporter commented 9 years ago
I am unable to reproduce the bug you are referring to. I have created (in 
Photoshop
CS3) 3 test images (PNG8, PNG24 and PNG24 with transparency) and all test files 
we're
resized correctly without error. I do not, however, have a FreeBSD environment 
to
test with. 

"You must repair lines 206 and 207 in file models.py:"

What "repairs" are you suggesting?

Original comment by justin.d...@gmail.com on 23 Oct 2007 at 3:50

GoogleCodeExporter commented 9 years ago
In your latest version you pass float numbers to method resize and crop. It 
cause on
my system printing of some error messages ("...you must use integer 
numbers...").

So, I patched your code to pass integer numbers to methods.

Your version:
  box = (x_diff, y_diff, (x-x_diff), (y-y_diff)) # variables x and y are floats, so
expressions (x-x_diff) and (y-y_diff) will be floats too
  resized = im.resize((x, y), Image.ANTIALIAS).crop(box) # again, x and y are floats,
box have float numbers too

My version:
  box = (x_diff, y_diff, int(x-x_diff), int(y-y_diff))
  resized = im.resize((int(x), int(y)), Image.ANTIALIAS).crop(box)

Original comment by maly.bzy...@gmail.com on 27 Oct 2007 at 10:24

GoogleCodeExporter commented 9 years ago
Had the same problem, while trying version 0.4.1 of Photologue, with Django 
6603 on
MacOSX. Justins fix made it work just fine.

Original comment by erwinell...@gmail.com on 29 Oct 2007 at 3:37

GoogleCodeExporter commented 9 years ago
I've applied the changes to both the 0.4 branch and trunk and attached a patch. 
Thank
you for submitting this issue.

Original comment by justin.d...@gmail.com on 30 Oct 2007 at 4:53

Attachments: