bitmaps not looking smooth - gdi+

I am loading raster files (png) in my viewer application. When I view these files in an application such as IrfanView everything looks very smooth. Somehow the antialiasing settings in my viewer application do not work: lines have very jagged edges.
I do set the SmoothingMode = Drawing2D.SmoothingMode.AntiAlias. I've tried different combinations of the various settings but to no avail.
Is GDI+ not capable of this like IrfanView is?

bitmaps aren't antialiased, text and vector images are - perhaps your problem is that the images are being stretched and resized

Related

Picture quality still reducing too much even after configuring resize images extension on firebase

I have an image upload function on my application that is using firebase as a backend. I've enabled the Resize Images extension, but the quality was too low on jpeg and webp files. In order to counteract this I added some Sharp Output Options as follows:
{"jpeg": {"quality": 100}, "webp": {"quality": 100, "lossless": true}}
There's no real information out there about what the potential values are for these fields.
You can see their suggested formatting for the Sharp Output Options here:
That's all the info I can find.
However, the image quality did not change after this config. Both before and after setting this configuration the image sizes were identical.
How can I properly set this configuration and increase the quality of the compressed images?
My solution was to increase the pixel size of the images. Instead of targeting 400x400, I chose 800x800. The file size was slightly larger, but only about an extra 7kb for an image that was originally 1.3mb. After firebase's compression, my 800x800 image was around 22kb, but with much better resolution than the 15kb 400x400 image I was trying at first.
I have the same problem.
When I tried to convert .jpg to .jpeg and set the option to {"quality": 5}, a clear deterioration was confirmed.
And the following three had the same degree of deterioration.
No options
{"Quality": 100}
No conversion
It seems that sharp in the extension has already been resized for minimal degradation.
Looking at the source file, sharp's outputOptions were only applied during the conversion.
I thought the cause was elsewhere and decided to finish my investigation into this extension.
However, I'm worried about rotate, which seems to be meaningless ...
SourceFile
https://github.com/firebase/extensions/blob/8efd4e18afdb62218e1422deee1d60c89df9ebb9/storage-resize-images/functions/src/resize-image.ts#L19
Sharp
https://sharp.pixelplumbing.com/api-output#jpeg

Why does my svg file look worse than my png file?

I am going through my image files and replacing them with svg, from png. The problem is that now, when I scale up or zoom in on mobile for example, the images look worse than they did with png.
As I understand, SVG is scalable vector graphics, so you should be able to scale them as big as you like without distortion.
Well, the images have been converted from png to svg so should, in theory, look better, mostly when scaled up.
You can see an example here of png background image at https://adsler.co.uk/jobs and svg here https://adsler.co.uk/dating/
You will see that in jobs (png) the image scales quite high before distortion but in dating (svg) it zooms only a bit before it distorts, whereas it should be the other way around.
So what am I doing wrong and how to fix please? Basically I just want crystal clear images across my site.
On further further inspection, in Chrome this is most definitely the case, but in Firefox, on mobile, it scales quite high before distortion.
Two points then come up.
Why is it distorting at all? It should be infinitely scalable.
When I zoom in on an svg in Firefox, does any distortion occur simply because my mobile phone reaches the peak of its display capacity?
The problem you're running into is that while this image is technically an SVG, the fact that it started as a PNG and was converted has left it as a png image wrapper in an svg, rather than a true vector.
If you open it up in a text editor you can see that the whole content inside the <svg> wrapper is an image attribute <image id="image0" width="2160" height="3840" x="0" y="0" xlink:href="... etc.
What this means is that it will essentially behave in the same way as a raster image rather than a vector graphic.
I'd advise trying to recreate the graphic as a vector using something like Illustrator, Sketch or Inkscape. Do you have the image saved in anything other than a png format?

QPixmap with .svg "couldn't create image from"?

i try to get an .svg to an QPixmap and i get the Error "couldn't create Image from".
Code:
QString test = "/home/ftp/DM262-WIF-269-0.svg";
QPixmap design(test);
ui->scan_bild->setPixmap(design);
ui->scan_bild->setScaledContents(true);
is there a Resolution for my Problem?
Thx
Felix
The SVG loader of Qt supports only a subset of SVG. It seems that embedding of raster graphics images in SVGs is not supported. (If I remember right embedding of SVGs in other SVGs doesn't work as well. – Too sad.)
To prove that I don't tell something wrong, I tested an icon of our software.
The following image shows how the Explorer Preview plug-in (based on Qt) shows the image:
The same image loaded into Firefox:
When I import this image in GIMP, the embedded image is considered as well.
So, if you don't want to re-design your SVG icon I see only one solution: render the SVGs into raster graphics images (e.g. PNG or JPEG) which are better supported in Qt – may be, with multi-resolution icons (QIcon – High DPI icons) for a better result.

Can't seem to disable anti-aliasing in Android

I'm new to Android, and I've finished a game which was meant to feature pixel art. I was going to scale up my images (imageviews and bitmaps drawn to canvas) from small pixelated png files. The thing is, I could not seem to disable anti-aliasing whatever method I tried. The image was always blurred.
All my images are in one 'drawable' folder.
I tried android:antialias="false" within the ImageView in the xml.
Tried the method described here: http://www.41post.com/4241/programming/android-disabling-anti-aliasing-for-pixel-art
\
Tried changing the paint (paint.setAntiAlias(false)) when drawing the bitmap onto a canvas.
And even tried linking the ImageView to a xml bitmap drawable with antialias="false"
Am I missing something? In the end I had to just settle with leaving some images blurry and having the big images as big images and not resizing in the xml file.
From the Hardware Acceleration Guide, it looks like Paint#setFilterBitmap() is always enabled and cannot be disabled when hardware acceleration is enabled. Try checking to see if your app is using hardware acceleration.
I've seen similar behavior in the emulator when enabling the "Use host GPU" option, and found that a device that didn't have the anti-aliasing behavior could be forced to have that behavior by using Paint#setFilterBitmap(true). I was not able to disable the behavior in the emulator though without disabling the host GPU option.

How do I resize a flat vector icon so that it preserves hard edges?

I recently purchased Drew Wilson's Pictos icon library. It is a library of flat, monochromatic icons for use on the web and elsewhere. The only issue is: they're vectors. I know my way around Illustrator a little bit, but ultimately I want to import these icons into Photoshop CS4 and resize to various dimensions.
When I import an icon and resize it to, say, 20x20 pixels, I notice that there is a fair bit of aliasing around the edges of the icon. I'm sure there is some magic number where the edges of these icons will remain crisp, but I can't find any option or setting that will allow me to size these icons properly.
How can I snap these icons to the closest size that removes or minimizes the aliasing?
The aliasing / pixelating is because vectors export out of illustator # whatever size they're copied #
Try opening the icons in illustrator... scaling them waaay up
And then just keep a copy of the huge ones in a separate layer
Copy that layer when you want to scale it down ..annnd that way you'll have a copy to work with..and u won't have to re
Open the file every time u need to make an edit
And a good rule of thumb for pixelation is
You can always size down.. but sizing up will create pixelating in bitmaps
Chances are, you have your logo in .eps format. If you do, open your .eps file in Photoshop. A dialog box will pop up asking the size you want to import. Be sure to select RGB color if this will display on the web. Select the Anti-aliasing checkbox. When your file opens up, zoom in, and you'll notice that Photoshop has neatly anti-aliased all of your edges for you.

Resources