Hi,
I've written a small image viewer which basically mirrors html's "map",
i.e. each image has a set of areas which link to other images. I'm using
it to view pages from a street atlas which I've scanned (you click on
the arrows that indicate on which page the map continues) and also
photo's I've taken from street corners in a city (you click on the left
or right side of the image to virtually turn left or right, click on the
top of the image to advance to the next corner, click on the bottom of
the image to turn 180�).
Since the images themselves are quite big, I'm using a scrolled canvas,
but I'd also like to scale images to (arbitrary) sizes. I just scale the
areas' coordinates by my rescale factor (e.g. 0.33) which works quite
fine, but I use Image::Copy(-shrink, -subsample => 1/$scale) which does
not work as desired as it wants to subsample using integral values, so
if my rescale factor is 0.33, the areas and the rescaled image do not match.
How would I rescale an image using arbitrary, non-integral scaling factors?
Thanks,
Josef
--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef M�llers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html
|
|
0
|
|
|
|
Reply
|
Josef
|
10/27/2009 9:12:57 AM |
|
Josef Moellers wrote:
> Hi,
>
> I've written a small image viewer which basically mirrors html's "map",
> i.e. each image has a set of areas which link to other images. I'm using
> it to view pages from a street atlas which I've scanned (you click on
> the arrows that indicate on which page the map continues) and also
> photo's I've taken from street corners in a city (you click on the left
> or right side of the image to virtually turn left or right, click on the
> top of the image to advance to the next corner, click on the bottom of
> the image to turn 180�).
>
> Since the images themselves are quite big, I'm using a scrolled canvas,
> but I'd also like to scale images to (arbitrary) sizes. I just scale the
> areas' coordinates by my rescale factor (e.g. 0.33) which works quite
> fine, but I use Image::Copy(-shrink, -subsample => 1/$scale) which does
> not work as desired as it wants to subsample using integral values, so
> if my rescale factor is 0.33, the areas and the rescaled image do not
> match.
>
> How would I rescale an image using arbitrary, non-integral scaling factors?
>
> Thanks,
>
> Josef
External graphics libraries are the best bet for image manipulation.
Use Image::Magick scale or mogrify resize. There is also an
Image::Resize which uses GD.
|
|
0
|
|
|
|
Reply
|
Steve
|
10/27/2009 9:53:46 PM
|
|
Am Tue, 27 Oct 2009 17:53:46 -0400 schrieb Steve C:
> External graphics libraries are the best bet for image manipulation. Use
> Image::Magick scale or mogrify resize. There is also an Image::Resize
> which uses GD.
I've heard from others that the API of ImageMagick changes often.
In my experience ImageMagick is sometimes eating up a lot of memory and it
seems show more bugs than other image manipulation packages.
For me Imager is working quite well.
Oliver
|
|
0
|
|
|
|
Reply
|
Oliver
|
10/29/2009 9:38:16 PM
|
|
Oliver 'ojo' Bedford wrote:
> Am Tue, 27 Oct 2009 17:53:46 -0400 schrieb Steve C:
>
>> External graphics libraries are the best bet for image manipulation. Use
>> Image::Magick scale or mogrify resize. There is also an Image::Resize
>> which uses GD.
>
> I've heard from others that the API of ImageMagick changes often.
> In my experience ImageMagick is sometimes eating up a lot of memory and it
> seems show more bugs than other image manipulation packages.
>
> For me Imager is working quite well.
Thanks for the hints. I have used Image::Magick already elsewhere (e.g.
using Annotate to create title slides for slide-shows), but they all
seem to be alien to Tk!
I would have to load an image, rescale it, then store it back into a
file and the reload it using Tk::Photo. Any idea how I could load the
image, rescale and then hand over to Tk::Photo? I know that I can use an
in-core image if that's encoded, so I would do that (use encode_base64()
from MIME::Base64), I'd like to avoid the store and reload.
Thanks,
Josef
--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html
|
|
0
|
|
|
|
Reply
|
Josef
|
10/30/2009 10:39:30 AM
|
|
Am Fri, 30 Oct 2009 11:39:30 +0100 schrieb Josef Moellers:
> I would have to load an image, rescale it, then store it back into a
> file and the reload it using Tk::Photo. Any idea how I could load the
> image, rescale and then hand over to Tk::Photo? I know that I can use an
> in-core image if that's encoded, so I would do that (use encode_base64()
> from MIME::Base64), I'd like to avoid the store and reload.
I'm using the method you describe (using encode_base64()). Something
along the lines
$img = Imager->new;
$img->read(file => "foo");
$newimg = $img->scale();
$newimg->write(data => \$inmemory);
$mainwindow->Photo("photo", data => encode_base64($inmemory));
Works well, although to me it feels a bit clumsy.
Until now I haven't found a better alternative.
Oliver
|
|
0
|
|
|
|
Reply
|
Oliver
|
11/1/2009 10:55:24 AM
|
|
Oliver 'ojo' Bedford wrote:
> Am Fri, 30 Oct 2009 11:39:30 +0100 schrieb Josef Moellers:
>
>> I would have to load an image, rescale it, then store it back into a
>> file and the reload it using Tk::Photo. Any idea how I could load the
>> image, rescale and then hand over to Tk::Photo? I know that I can use an
>> in-core image if that's encoded, so I would do that (use encode_base64()
>> from MIME::Base64), I'd like to avoid the store and reload.
>
> I'm using the method you describe (using encode_base64()). Something
> along the lines
>
> $img = Imager->new;
> $img->read(file => "foo");
> $newimg = $img->scale();
> $newimg->write(data => \$inmemory);
> $mainwindow->Photo("photo", data => encode_base64($inmemory));
>
> Works well, although to me it feels a bit clumsy.
> Until now I haven't found a better alternative.
Thanks in a million. That did the trick.
Not sure if handling a 7 Megapixel image in memory is The Right Thing,
but ... it does what I want it to do.
Josef
--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html
|
|
0
|
|
|
|
Reply
|
Josef
|
11/2/2009 9:53:06 AM
|
|
|
5 Replies
188 Views
(page loaded in 0.111 seconds)
Similiar Articles: RGB to gray scale to RGB - comp.soft-sys.matlabHello, I want to convert my RGB image to gray to complete a step that requires uint8. But after that step, is there a way for me to put the gray scale back to RGB? How to plot data on actual scale? - comp.soft-sys.matlab ...Can anyone here please inform me the proceedure so that I can print my geometry built on an actual scale because now when I print this image, it just shrink or enlarge my ... greyscale 2D image to 3D autocad file - comp.soft-sys.matlab ...Hi ALL: Want to know if this is possible. Have a 2D gray scale image. The gray value is the elevation or Z value. Can we convert it into a 3D auto... Image rotation: imrotate - comp.soft-sys.matlabHi, I need to rotate a gray scale image by 61 deg. I was wondering for a gray scale image, which scheme will be more accurate in imrotate: 'nearest' ... How to find local standard deviation of an image? - comp.soft-sys ...% Read in one of the standard MATLAB demo images % as our original gray scale image and display it. promptMessage =3D sprintf('Which image do you want to use ... steps to convert RGB (colored image) to binary? - comp.soft-sys ...I have confused I want black/white image I try img= im2bw(imageName); but it is became gray scale not black/white Please help me with the steps to get binary image ... Log scale and image data - comp.graphics.apps.gnuplotJoey Mukherjee wrote: > No, the y-data does not contain zero or negative numbers. [...] > My plot goes from 0 to 250 on the y axis? Hmm... haven't you just ... gradient magnitude image - comp.soft-sys.matlab[rows columns numberOfColorBands] = size(grayImage); % Display the original gray scale image. subplot(2, 2, 1); imshow(grayImage, []); title('Original Grayscale Image ... how to plot histogram in 12-bit from an 16-bit image? - comp.soft ...... subplot(2, 2, 3); bar(grayLevels16, pixelCount16); title('Histogram of 16 bit image'); xlim([0 grayLevels16(end)]); % Scale x axis manually. % Convert 16 bit image ... How to capture coordinates (x,y) through event click mouse - comp ...[rows columns numberOfColorBands] = size(grayImage); % Display the original gray scale image. imshow(grayImage, []); title('Original Grayscale Image', 'FontSize ... Scale your image online - It's easy, it's free!Scale your image online in three simple steps: Select your image by browsing your desktop, select and press ok. Scale Your Image supports different extensions as .jpg ... Learn how to scale an image | TechRepublicMost image editors can help you make an image bigger or smaller. Here are few guidelines that you can use to get better results. 7/17/2012 10:00:02 PM
|