Re: [Gimp-user] resizing



On Sat, 2019-07-20 at 15:33 -0400, Helen via gimp-user-list wrote:
I'm submitting a picture that needs to be 1.5 megapixels.   How do I
tell GIMP that this picture should be 1.5 M?

This is a slightly mathsy reply but i hope the short answer isn't too
intimidating :)....

Is it megapixels or megabytes?

If megapixels, that's 1.5 * 1048576 pixels = 1572864 pixels.

Short answer
============

Open up scale image and note the current width and height of the image
in pixels (set the units to px in the dropdown to the side of Height if
yo uneed to) and then...

1. divide 1572864 by the current image width in pixels.
2. multiply that number by the image *height* in pixels
3. take the square root of that result
4. put that number into the Height field in Scale Image
5. the Width field should update auomatically

Handy Hint: the result of scaling down an image looks bst if it's a
factor of two, so swich units to % and ee. If it's nearly a factor of
two, 51.2%, you'll get a better image by scaling down to 50% and then
if needs be adding a solid border to make up the size.

You may need to sharpen the image after scaling; use LoHalo or NoHalo
as "interpolation" in the Scale Image dialog to see if they give a good
result.

Handy Hint Two: scaling up to make an image larger is asking GIMP to
invent data. It doesn't do a good job at being creative. You can use
the resynthesize plugin to try and do a better job, maybe.

If you needs megabytes, it depends on the bits per pixel, but if 8, the
calculation is similar but for an RGB JPEG image (no transparency) it's
that same number 1572864 divided by three (for red, blue and green
values for each pixel). That's 524288, so use 524288 in the formula to
get megaytes instead of megapixels. I think.

Long answer:
============

If your current image is w wide and h high, then it is
(w * h / 1048576) megapixels currently.

You need to end up with w * h = 1048576 * 1.5
that is, neww * newh = 1572864

But we want to keep the aspect ratio of the picture when we scale or it
will distort. So, we need that
    neww/newh = w/h.

 Armed with this, we can write, by multiplying both sides by neww,
    neww = w * newh/h
and, from before,
    neww = 1572864 / newh
So,
    w * newh/h = 1572864 / newh
multiplying by newh * h and dividing by w we get,
    newh * hewh = 1572864 * h / w
So, newh = sqrt(1572864 * h / w)


So, in scale image, in the Height field, use a calculator, substitute
in the current w and h values, do the calculation and take its square
root.


    
-- 
Liam Quin - web slave for https://www.fromoldbooks.org/
with fabulous vintage art and fascinating texts to read.
Click here to have the slave beaten.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]