473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

PIL and antialiasing problem

Hi all,

I have a little problem with PIL. I need to display images in a
browser (thumbnails) (this is the selector window).
I also need the original version of the image to be displayed in a
Java applet.

One example:

thumbnail: http://designasign.biz/applet/GIF_Sm...AFT/a10per.png
original: http://designasign.biz/applet/GIF/AIRCRAFT/a10per.png

I made the thumbnail from the original image using PIL this way:
im = Image.open(fullpath)
try:
im.thumbnail(THUMBSIZE,Image.ANTIALIAS)
im.save(thumbpath)
finally:
del im
If I do not use ANTIALIAS, then I get this:

http://designasign.biz/tmp/a10per.png

With the ANTIALIAS-ed version, the problem is that you cannot see the
lines - they are very light gray, almost invisible. I have many cliparts
with thin lines. However, I also have many cliparts like this:

http://designasign.biz/applet/GIF/AFRICA/angel03.png

I tried to posterize or darken the images but I could not find a good
solution. (I also tried to count the number of colors in the image and
use this info.) Can you suggest an image filter and/or method that creates
darker black lines from the original thin lines? Also it would be
great to have it working with those colorful smudged images. It will
be terribly slow to separate them by hand. There are almost 15000 of
them...

--
Thanks,
Laszlo

mailto:ga*****@geochemsource.com
web: http://designasign.biz

Jul 18 '05 #1
4 3931
Laszlo Zsolt Nagy wrote:

I tried to posterize or darken the images but I could not find a good
solution. (I also tried to count the number of colors in the image and
use this info.) Can you suggest an image filter and/or method that creates
darker black lines from the original thin lines? Also it would be
great to have it working with those colorful smudged images. It will
be terribly slow to separate them by hand. There are almost 15000 of
them...


Try running ImageFilter.MinFilter on the image before you thumbnail it.
This should make dark lines thicker.

HTH,

Will McGugan
Jul 18 '05 #2
> Try running ImageFilter.MinFilter on the image before you thumbnail it.
This should make dark lines thicker.
HTH,
Will McGugan


You are my man! It worked perfectly!

Statement: Sometimes PIL is better than Adobe Photoshop. :-)

I also found these with the aid of the wonderful dir() function:

MinFilter, MaxFilter, MedianFilter, ModeFilter, RankFilter, BuiltInFilter

They do not have a docstring and they are not documented in the
handbook. I'm curious what they do exactly. The others (like BLUR, EMBOSS,
CONTOUR etc.) are documented very well. I wonder why is that.
Python forever,

Laszlo

mailto:ga*****@geochemsource.com
web:http://designasign.biz

Jul 18 '05 #3
Laszlo Zsolt Nagy wrote:
Try running ImageFilter.MinFilter on the image before you thumbnail it.
This should make dark lines thicker.
HTH,
Will McGugan

You are my man! It worked perfectly!

Statement: Sometimes PIL is better than Adobe Photoshop. :-)


Happy to help :)

I also found these with the aid of the wonderful dir() function:

MinFilter, MaxFilter, MedianFilter, ModeFilter, RankFilter, BuiltInFilter


MinFilter replaces each pixel with the darkest pixel within the filter
area. MaxFilter replaces each pixel with the brightest of the
surrounding pixels. MedianFilter sorts the surrounding pixels by
brightness and selects the middle value. I think ModeFilter selects the
most common pixel if occurs more than a certain threshhold. RankFilter
is like Median, but it selects the colour at a specific point within the
ordered list. Not sure about BuiltInFilter, my guess is its an
implementation detail of some kind..
Regards,

Will McGugan
Jul 18 '05 #4
Laszlo Zsolt Nagy wrote:
Statement: Sometimes PIL is better than Adobe Photoshop. :-)

I also found these with the aid of the wonderful dir() function:

MinFilter, MaxFilter, MedianFilter, ModeFilter, RankFilter, BuiltInFilter

They do not have a docstring and they are not documented in the
handbook. I'm curious what they do exactly. The others (like BLUR, EMBOSS,
CONTOUR etc.) are documented very well. I wonder why is that.


they were experimental (and some of them were slightly broken, iirc)
in 1.1.4. they're all officially supported in 1.1.5:

http://www.pythonware.com/library/pi...magefilter.htm

</F>


Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Leif Wessman | last post by:
From: http://www.php.net/manual/en/function.imagettftext.php "color is the color index. Using the negative of a color index has the effect of turning off antialiasing." I'm using a bundled...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
4
by: Smoke | last post by:
It is possible to draw a line on a control using AA? basically, i need the normal .DrawLine funcion but that support antia aliasing. is this possible? can somebody tellme how? Thanks for the...
0
by: Turbot | last post by:
Does anyone know how to stop a RichTextBox control from antialiasing the text you enter into it?
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
2
by: RSH | last post by:
I have been experimenting with overriding the Paint event on Win Form controls...more specifically trying to force the text to render as Antialiased text. I have not been successful in any of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.