473,767 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(full path)
try:
im.thumbnail(TH UMBSIZE,Image.A NTIALIAS)
im.save(thumbpa th)
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.c om
web: http://designasign.biz

Jul 18 '05 #1
4 3963
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.Min Filter on the image before you thumbnail it.
This should make dark lines thicker.

HTH,

Will McGugan
Jul 18 '05 #2
> Try running ImageFilter.Min Filter 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.c om
web:http://designasign.biz

Jul 18 '05 #3
Laszlo Zsolt Nagy wrote:
Try running ImageFilter.Min Filter 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
4416
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 version of GD: 2.0.23 compatible. When using the function imagettftext() with a negative color to get a aliased text as stated in the docs the text gets grainy. Not antialised, and not aliased. Something in between (ugly!). I've tried several fonts....
117
7254
by: Peter Olcott | last post by:
www.halting-problem.com
28
5222
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(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I don't know at runtime what the child class is? I'm using Activator.CreateInstance() to load the...
6
3812
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 is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is less than or equal to 1249 then no problem.
4
5761
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 help, as usual
0
1086
by: Turbot | last post by:
Does anyone know how to stop a RichTextBox control from antialiasing the text you enter into it?
16
4927
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 Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
2
4555
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 set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following:
2
7010
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 methods Ive tried...is there a trick? Any information or examples would be greatly appreciated. Thanks! Ron
0
9571
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10013
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3930
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.