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.
Related
I am working on a existing Qt application and trying to support it on 4K monitor. For scaling the app, I am using "QT_SCREEN_SCALE_FACTOR" and scaling fonts based on logical DPI of screen. Everything is fine till this. Fonts for ribbon, docked windows are ok after scaling. But the font is getting too bigger for floating forms (pop up dialogs) and the docked widgets after undocking (the moment window is undocked, font is becoming bigger). I don't understand why this is happening. Is windows taking control over floating forms and making font bigger? Or am I missing something?
I am not using "Qt::AA_EnableHighDpiScaling" or "QT_SCALE_FACTOR" because I did not find these useful for me.
Has anyone faced this kind of problem?
Please let me know if someone knows about this.
After trying this and that, I found a solution to this problem.
I added'QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling);' before creating QApp. And then I just needed to change the font size.
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
I was given a new laptop at work and when I switch back and forth from a docking station, RStudio seems to have problems realizing the change in display, while all the other programs seem to auto-detect and re-zoom appropriately. The only fixes I've found is logging out and back into my Windows user account, or going through R-Studio's View>Zoom-in or View>Zoom-out when going back and forth between docked and undocked, which takes time.
There's not some setting I'm missing, is there, so RStudio detects the type of display and auto-adjusts? Example images below.
thank you, dave
This is a known issue, and there is some indication that there are plans to address this in rstudio v1.2.
https://community.rstudio.com/t/dramatic-screen-resolution-issue-see-screen-snip/3703/6
A workaround suggested here:
You should be able to work around this by toggling the Zoom level in the Appearances pane
RStudio is basically a browser window (chrome web application). It will render according to the resolution of the screen, at the current zoom setting. It will not change your zoom level as you switch monitors. Ctr- and Ctrl+ are shortcuts for zooming in and out, where you should also see a popup with a reset (to 100%) option.
Zooming is not the same as changing font sizes, which is the preferable way of ensuring a good visual experience for a resolution.
I am instantiating a QImage from an image file like below and subsequently rendering it on a QWidget.
QImage ( const QString & fileName, const char * format = 0 )
For most images, everything works fine. But for a few images, the QImage gets loaded with a 90-degree rotated image.
It seems this happens only with pictures taken earlier on my phone in portrait mode. Those taken in landscape are fine
You might need to use a library like libexif to determine the photo orientation and then rotate the QImage accordingly
Since Qt 5.5 set Image.autoTransform : true because the default is false!
QT Image QML Type reference
With C++ Qt-class QImageReader:
QImageReader imgReader( imagePath );
imgReader.setAutoTransform( true );
QImage img = imgReader.read();
https://discussions.apple.com/thread/2541504?start=0&tstart=0
It sounds like it is a pretty common issue, where there is some flag or tag added on the image that says how to rotate it, instead of actually reordering the pixels in the image. For the image you are trying to render, you could go and take the format you are trying to use, and see if there are any extra flags you could check and have Qt do the rotation.
Sounds like cppguy knows of a library that can let you check these flags.
EDIT Found a better description for it:
johninsj - Re: iPhone 4 Photo's & Video Rotating Sideways In Email
Nov 2, 2010 1:45 PM (in response to VibrantRedGT)
Apple sets the jpeg meta tag for orientation when you shoot a photo,
so if you hold the iphone upside down, or sideways, etc, the image
(which is shot upside down or sideways, since the camera is upside
down/sideways) knows it needs to flip/rotate the image when you look
at it.
Not all software honors the rotation settings. Gimp (which runs on
everything, and is free) does.
You can rotate images and save them, or learn to shoot photos with the
iPhone in the correct orientation for non-rotated images. That would
be with the home button to the right as you look at the screen.
Hope that helps.
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