how to keep raster quality/detail when scaling down?

Post questions on how to use or achieve an effect in Inkscape.
hiccup
Posts: 6
Joined: Tue Oct 09, 2018 12:49 pm

how to keep raster quality/detail when scaling down?

Postby hiccup » Tue Oct 09, 2018 1:03 pm

hi -
i'm new to vector graphics and inkscape, working on a project to help my kids think about geography.

i downloaded a generic blank world map with country outlines in .svg from wikipedia. i want to create overlays for each country we study that have layers for topography, satellite image, population density, etc. inkscape opens the .svg fine, and using "document properties" i see it has about the size i intended to work with -- each continent fits roughly on 8.5"x11".

then i used ctrl-v to paste a topographic map for a certain country that i copied from a png into a new layer. it appears at full resolution fine. i used low opacity to scale it down and move it to sit in the correct location. however, scaling down the raster loses a ton of detail/quality. if i understand svg correctly, i should be able to scale down raster images without losing quality -- i should always be able to zoom down to the original pixels, no matter how small they get. i need the original quality preserved, and hope to only lose quality when finally rendering on a particular printer/screen/etc.

is there any way to do this?

i'm on osx 10.13.6 and installed inkscape 0.92.2 2405546 using macports (x11, not xquartz).
thanks!
-erik

User avatar
brynn
Posts: 9995
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: how to keep raster quality/detail when scaling down?

Postby brynn » Tue Oct 09, 2018 8:09 pm

No, I think you misunderstood about SVG and scaling. There's no way to scale a raster image without losing quality. Just because it's in an SVG or other vector format file, it's still a raster image, and it still pixelates when scaled (or zoomed).

Moini
Posts: 2845
Joined: Mon Oct 05, 2015 10:44 am

Re: how to keep raster quality/detail when scaling down?

Postby Moini » Tue Oct 09, 2018 8:55 pm

When I zoom into a bitmap image that I scaled in Inkscape with the scaling handles, I can see all the details that are in it (i.e. it pixelates at its real pixels). I'm not sure, though, if that's what you've been doing.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

hiccup
Posts: 6
Joined: Tue Oct 09, 2018 12:49 pm

Re: how to keep raster quality/detail when scaling down?

Postby hiccup » Wed Oct 10, 2018 1:48 am

@brynn, can you cite a reference supporting your claim? i can't find a reference that explicitly states otherwise, but my understanding is that a raster image embedded in an svg keeps all of its data. scaling it simply defines the size at which it is rendered (like html <img height/width>).

importing the png allows scaling down without losing quality. it must be the copy/paste that causes the problem. anyone know why they are different?

hiccup
Posts: 6
Joined: Tue Oct 09, 2018 12:49 pm

Re: how to keep raster quality/detail when scaling down?

Postby hiccup » Wed Oct 10, 2018 4:47 am

@Moini: what OS/inkscape version?

Moini
Posts: 2845
Joined: Mon Oct 05, 2015 10:44 am

Re: how to keep raster quality/detail when scaling down?

Postby Moini » Wed Oct 10, 2018 10:43 am

@hiccup: does copy/paste work correctly for you with the x11 version? That can be a source of confusion, it's making bitmap copies with 96 dpi on Mac with XQuartz, dunno about x11.

See our FAQ: https://inkscape.org/en/learn/faq/#copy ... es-objects

Linux Mint 18.3, 0.92.3.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 9995
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: how to keep raster quality/detail when scaling down?

Postby brynn » Thu Oct 11, 2018 8:02 am

No, I can't cite any references. It's just a fact of life that if you scale a raster image, it will pixelate. I have heard people say that scaling down a raster image won't pixelate it, but I've never been able to accomplish any scaling of a raster image, without degrading the sharpness. I suppose I could say that scaling down doesn't seem to pixelate as badly as scaling up. But I still can notice it.

It's possible that I'm misunderstanding what you're trying to say. I'm not sure what you mean when you say that it "keeps all of its data". What data? Pixels, dpi, the string of (seemingly) random characters which defines the raster image?

I mean, like Moini says, you can zoom into a raster image and see the pixels. You can see the pixels very, VERY clearly if you use the Blocky (optimize speed) option, on import. If you use any of the other options, it might be harder to see the actual pixels.

If you scale the image, it looks to me like the pixels get larger (and scale down they get smaller). So if you scale a raster image within Inkscape, the DPI must be changing. The pixels are getting larger or smaller, but the number of pixels remains the same.

Using the XML Editor, I can see that scaling a raster image doesn't change the string of seemingly random characters. Maybe that's what you mean by keeping the data?

Moini
Posts: 2845
Joined: Mon Oct 05, 2015 10:44 am

Re: how to keep raster quality/detail when scaling down?

Postby Moini » Thu Oct 11, 2018 9:28 am

Brynn, in Inkscape, if you use the handles to scale a raster image, it just makes it look smaller, it keeps all image data points. Inkscape does not edit raster images. This is in concordance with your observations in the XML editor.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

hiccup
Posts: 6
Joined: Tue Oct 09, 2018 12:49 pm

Re: how to keep raster quality/detail when scaling down?

Postby hiccup » Fri Oct 12, 2018 3:10 pm

@Moini - well, according to the FAQ, copy/paste on OSX *rasterizes vectors.* but this was already a raster, what it did was *reduce its quality/resolution" -- i guess because it uses screen capture instead of looking at the actual data in the clipboard? doesn't make sense to me because i right-click copied a png from a webpage, so the clipboard had the full resolution. there was no "screen" for x11 to "capture", and i don't know why it would think it would need to since it wasn't a vector.

@Brynn - think of embedding a raster as saying "draw all these dots in a square with these dimensions." then, if you scale it down, you're saying "put those same dots in a square with these other dimensions." either way, it's still all the same dots. if you zoom in, you can still see them all. a particular rendering at a particular scale may not be able to draw or show them all, but they would be there if you changed the scale or the resolution of the rendering. that's how it works when you import on OSX, or import/cut/paste on other platforms. but the bug on OSX is that it throws away some dots.

Moini
Posts: 2845
Joined: Mon Oct 05, 2015 10:44 am

Re: how to keep raster quality/detail when scaling down?

Postby Moini » Fri Oct 12, 2018 10:41 pm

It's the same underlying issue, as far as I understand, yes. Are you able to change the pasteboard settings in your installation?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 9995
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: how to keep raster quality/detail when scaling down?

Postby brynn » Fri Oct 12, 2018 11:57 pm

Well I know that if you paste vector contents on a Mac, it rasterizes the pasted content. Are you saying that pasting a raster image damages the raster image? Or that scaling it after you paste it damages it (but doesn't damage non-pasted raster image)?

I'm not sure if that's been known, up until now. At least I haven't heard it.

But if that's the problem, you can avoid it by not using Copy/Paste. As far as I understand, it's more typical to use Duplicate, rather than copy/paste, in graphics. (I have no idea why, but that's what I've been told.) (here in this forum, years ago) Edit menu > Duplicate, or this button in the command bar Image, or else there's probably a keyboard shortcut (Help menu > Key and Mouse Ref).

I'm sure that must be a big pain for Mac users. It's a llooooong standing bug, which probably means that it's very hard to fix.

tylerdurden
Posts: 2118
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: how to keep raster quality/detail when scaling down?

Postby tylerdurden » Sat Oct 13, 2018 12:24 am

hiccup wrote:importing the png allows scaling down without losing quality. it must be the copy/paste that causes the problem. anyone know why they are different?

I concur with Moini... Most likely the Mac copy buffer issue.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/


Return to “Help with using Inkscape”

Who is online

Users browsing this forum: No registered users and 11 guests