I have following code to convert a big image to smaller thumbnail,
it work's fine until one day this image come out http://www.here4now.com/mobdata/sunb...Untitled-2.gif
The original size is 200x205, if I resize it to 101x103, it looks
still fine, but one pixed smaller , say 100x102, the result image is
total unacceptable.
Any help or hint will be appreciate
Ivan Wang
P.S. I didn't use Image.getScaled Instance to resize the image because
our server don't have X-window installed.
/*************** *************** *************** *************** *******/
public static void resize(String file1, String file2){
source = JAI.create("fil eload", file1);
ParameterBlock pb = new ParameterBlock( );
pb.addSource(so urce);
pb.add(null).ad d(null).add(nul l).add(null).ad d(null);
RenderableImage ren = JAI.createRende rable("renderab le", pb);
pb = new ParameterBlock( );
pb.addSource(re n);
int w = source.getWidth ()/2;
int h = source.getHeigh t()/2;
//RenderingHints renderingHints = new RenderingHints( null );
//renderingHints. put( RenderingHints. KEY_COLOR_RENDE RING,
// RenderingHints. VALUE_COLOR_REN DER_QUALITY );
PlanarImage dst = (PlanarImage)re n.createScaledR endering(w, h,
null);
JAI.create("fil estore",dst,fil e2,"PNG");
}
/*************** *************** *************** *************** *******/ 2 3897
On 28 Jun 2004 07:44:53 -0700, xj******@yahoo. com
(xj******@hotma il.com) wrote or quoted : The original size is 200x205, if I resize it to 101x103, it looks still fine, but one pixed smaller , say 100x102, the result image is total unacceptable.
Any help or hint will be appreciate
Gifs only look decent resized when you scale them by powers of two.
If you want something that scales well, use JPEG.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. xj******@yahoo. com (xj******@hotma il.com) wrote in message news:<a9******* *************** ****@posting.go ogle.com>... I have following code to convert a big image to smaller thumbnail, it work's fine until one day this image come out
http://www.here4now.com/mobdata/sunb...Untitled-2.gif
The original size is 200x205, if I resize it to 101x103, it looks still fine, but one pixed smaller , say 100x102, the result image is total unacceptable.
Any help or hint will be appreciate
Ivan Wang
P.S. I didn't use Image.getScaled Instance to resize the image because our server don't have X-window installed. /*************** *************** *************** *************** *******/ public static void resize(String file1, String file2){ source = JAI.create("fil eload", file1); ParameterBlock pb = new ParameterBlock( ); pb.addSource(so urce); pb.add(null).ad d(null).add(nul l).add(null).ad d(null); RenderableImage ren = JAI.createRende rable("renderab le", pb); pb = new ParameterBlock( ); pb.addSource(re n); int w = source.getWidth ()/2; int h = source.getHeigh t()/2; //RenderingHints renderingHints = new RenderingHints( null ); //renderingHints. put( RenderingHints. KEY_COLOR_RENDE RING, // RenderingHints. VALUE_COLOR_REN DER_QUALITY ); PlanarImage dst = (PlanarImage)re n.createScaledR endering(w, h, null); JAI.create("fil estore",dst,fil e2,"PNG"); } /*************** *************** *************** *************** *******/
Here is my new code, the scaled picture looks alright this time
public static void resize(String file1, String file2){
source = JAI.create("fil eload", file1);
ParameterBlock pb = new ParameterBlock( );
pb.addSource(so urce);
pb.add(null).ad d(null).add(nul l).add(null).ad d(null);
RenderableImage ren = JAI.createRende rable("renderab le", pb);
int h = source.getHeigh t();
int w = source.getWidth ();
PlanarImage dst = (PlanarImage)re n.createScaledR endering(w, h, null);
pb = new ParameterBlock( );
pb.addSource(ds t);
pb.add(0.3f); // 0.3 is just some test data
pb.add(0.3f);
pb.add(0.0f);
pb.add(0.0f);
pb.add(new InterpolationNe arest()); // <-- this is the key
PlanarImage transformedImag e = JAI.create("sca le", pb, null);
JAI.create("fil estore",transfo rmedImage,file2 ,"PNG");
}
=============== =============== =============== ==============
I have to use JAI.create("sca le",pb,hints)
rather than createScaledRen dering(w, h, hints) to make it working. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike |
last post by:
Sites using thumbnail preview for world wide web file navigation and
searching.
Below are list of sites that are either researching or providing thumbnail
preview images for online web documents. Thumbnail previews are useful for
web site navigation particularly in search engines and directories such as
Google, Altavista and Yahoo. The preview images provide a portion of the
content of the electronic file to aid in navigation.
|
by: Chris Perry |
last post by:
How do you create a thumbnail constrained to a box, without distorting and
but making where it doesn't fill the box transparent.
I'm two thirds there :
Size fitImageSize = this.GetScaledImageDimensions(
myBitmap.Width, myBitmap.Height, intThumbWidth,
intThumbHeight);
Bitmap imgOutput = new Bitmap(myBitmap, fitImageSize.Width,
|
by: David Elliott |
last post by:
I am creating a control to display GIF/JPEG images for my website. The control
has a Panel to hold the images.
I would like to perform the following.
1) store the original on disk and create a thumbnail on the fly.
2) thumbnail will be 20% of the original size.
3) the panel will hold all the images of a specific directory
Using System.Drawing.Image, I can satisfy number 1 and 2, but how would I
output the info to the panel?
|
by: Chris D |
last post by:
Hi,
I have an application where a user uploads an image and I create two
thumbnails. One a small image and the second is a larger image but still
smaller then the original. I store these in SQL 2000 server.
The quality of the small thumbnail is ok, but the quality of the larger
image is terrible. I tried both Jpeg and Gif formats and there is no
difference.
|
by: Xah Lee |
last post by:
The following is a program to generate thumbnail images for a website.
Useful, if you want to do that.
It is used to generate the thumbnails for my “Banners, Damsels, and
Mores” project gallery. (
http://xahlee.org/Periodic_dosage_dir/lanci/lanci.html )
Comments and versions in other lang welcome.
Xah
| |
by: Summercoolness |
last post by:
In PIL, since thumbnail() first makes a draft copy of the image, and
then resize it, so thumbnail() can run a lot faster than resize()
because draft() seems a lot faster when resizing from very big images
to small images... (such as the original image is 3000 x 2000, and it
can make a draft really quickly to 375 x 250, and then resize to, say
200 x 133 as a thumbnail)
However, the double resizing probably will make a thumbnail with a...
|
by: barb |
last post by:
So that the world at large benefits from our efforts, here is one fully
documented way to use Windows Irfanview freeware to create thumbnail web
galleries (http://www.irfanview.com).
STEP 1: Start with original thumbnails & two empty sub directories
STEP 2: Create smaller versions of the originals for one sub directory
STEP 3: Create thumbnail version of the originals the other sub directory
STEP 4: Create an index.html pointing to the...
|
by: Mike Copeland |
last post by:
On my main page I have a small picture - it's actually too small to
be useful. I only have it there to show that there's something to look
at, but I don't know how to "expand" it so it can be seen in a
reasonable size. Here's my code so far:
<img src="IMG_0492.jpg" width="56" height="70" align="left"
hspace="5" />
This picture consumes the whole screen (it's 952KB) when I click on
the file in Explorer, and I want the same sort of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |