How do you optimize a JPEG image for MSI installers? - graphics

I am dealing with a splash screen logo and I've noticed that on different OS versions this image gets distorted, but it happens to work when dealing with Windows 8.1, but not on Windows 7 or Vista. I've been using Adobe Fireworks in conjunction with Illustrator to generate it, and I must have tried a ton of different settings but I can't get the same experience across all operating systems.
I load it into my WiX project as follows:
<Binary Id="SplashBinary" SourceFile="Splash.jpg"/>
And I use it like so:
<Control Id="SplashBitmap" Type="Bitmap" X="0" Y="0" Width="373" Height="252" Text="SplashBinary" TabSkip="yes" Sunken="no" Disabled="yes" />
I've tried using the width and height above but it would not look good on 8.1 (too blurry), so I doubled it on the image to get a crisper result in Windows 8.1 (its perfect in 8.1). But again, it looks like its aliasing is messed up on 7 and Vista. Can anyone shed some light as to what I need to do to get a consistent experience? What do I need to do to my image to export it such that it renders a nice crisp result on these platforms?

I got it to work by scaling my image up by an exact factor of 1.3333333333 (I got this idea from this question):
[ Width ] -> 373 * 1.3333333333 = 497.3333333209
[ Height ] -> 252 * 1.3333333333 = 335.9999999916
This is the stupidest thing I've ever had to do. I don't know why this is the case. However, it now looks fantastic on all operating systems. I'm so displeased by this being a necessary step. PS: I also have my image at a resolution of 300 PPI.

Related

Text distorting during PNG rendering in Apache Batik

There are some very strange distortion in the images that are rendered via Apache Batik.This issue is not temporary as the distortion is happening every time the call is made, at the very same co-ordinates for the same svg. This happens in Linux environments and I am not able to reproduce this issue in mac OS environments.I am using Oswald custom font (from google fonts) and there is usage of transformation attributes like letter-spacing, rotate functionality.
Tried many of the suggestions like:
1) Verified if the Oswald font is registered to the Graphics environment.
2) Removed text transformation attributes like letter-spacing,rotate, but still the distortion is occuring. We have also replaced letter-spacing attributes with kerning.Tried with shape-rendering="geometricPrecision" also to no success.
3) Tried with other fonts and din't face the distortion with Arial custom font, but with Oswald, Roboto the distortion still exists.Our usecase needs Oswald Font, hence we cannot use Arial font.
4) Tried SVG fonts by embedding the svg fonts in the svg file - No success.
5) Tried trim functionality but no success.
6) Replaced the characters where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.
7) Increased And decreased the font size by 1px where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.
I found few threads where the reason was mentioned that Batik rendering varies per OS environment but was not able to find any solution. Was anyone able to solve this?
Upgrading JDK from 8 to 11 has solved the problem.

Upgrading from Inkscape 0.91 to 0.92 or higher breaks object dpi scaling

Following an upgrade from Inkscape 0.91 to any newer version I found that it broke the scaling on a number of my objects which are used for interactive display.
It appears a change in the DPI setting from 90 to 69 is the issue.
When opening some of my old drawings I get a dialogue box prompt asking which action I should take; Having tried all of those with none giving me the expected (working) output.
But not all of my drawing files would trigger this dialogue but they would still have there objects rescaled on load/save.
I also tried updating the version number in the .svg file manually but this didn't work either.
How can I work with my original files but gain the rewards of the newer(est) version(s) of Inkscape?
It turns out I was not alone in this problem. After much searching I found this thread over on the Inkscape forum.
To summarise and make it easy for people to find without wading though all the posts there are two things you need to do/check in order to upgrade without issue.
Install the new version to a different path if you are able.
Backup your original files.
With your favourite sane editor open the original .svg file directly and observe the header section;
inkscape:version="0.91 r13725"
That should be replaced with the version of Inkscape you are upgrading too. In my case it is;
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
Next look for the height and width settings and note they may not have a unit defined as in my case;
width="10000"
height="800"
Check in your original drawing what scale you had been using for your page size. It could be px, mm etc. The update the height/width section to include those units as shows below;
width="10000px"
height="800px"
Save the edited .svg file.
You should then be able to open/work on your old drawings in the current version of Inkscape without breaking scaling and display compatibility.

Why fonts in Qt are appearing blurry or pixelated?

All my fonts are appearing pixelated, so I used AntiAliasing but it isn't helping out. As you can see the pixelated font in the image itself:
This is the code I am currently using:
butt1 = QtWidgets.QLabel("""Scrappr""")
font = QtGui.QFont()
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
font.setPixelSize(22)
font.setFamily('Segoe UI Bold')
butt1.setFont(QtGui.QFont(font))
I tried different solutions on SO, qtforums etc but nothing works for me :(
I tried:
Different combinations of ClearType text but It didn't work out as, by default all the text appears good on windows and chrome but with Qt only, it becomes pixelated.
Changing windows aero theme to classic one...
But none of them helped.
Here are My PC Specs:
windows: 7 ultimate
PySide2 version: 5.14.2.1
Resolution: 1360 X 768
I'm using BrownPro font and the texts were blurry at all resolutions, but much more evident at low resolutions.
I was able to solve the issue by setting the hinting preference for the font to: PreferNoHinting. Applying it at the application level, fixes the issue everywhere.
Here is the documentation: https://doc.qt.io/qt-5/qfont.html#HintingPreference-enum
And here is the code I used:
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Light.ttf");
QFont brown_pro_font("BrownPro");
brown_pro_font.setHintingPreference(QFont::HintingPreference::PreferNoHinting); //This line did the trick
QApplication::setFont(brown_pro_font);
Try to see the fonts used by PyQt5:
import PyQt5
from pyQt5 import QtGui
dir(QtGui.QFont)
the result will show all you need for QFond and the fonts can be used:
[..., 'Helvetica',...,'SansSerif',..., 'Serif',..., 'Times', ...
You can try to add your custom fonts but you need to test each font.
For example, the documentation tells us:
In Windows a request for the “Courier” font is automatically changed to “Courier New”, an improved version of Courier that allows for smooth scaling. The older “Courier” bitmap font can be selected by setting the PreferBitmap style strategy (see setStyleStrategy() ).
Once a font is found, the remaining attributes are matched in order of priority:
fixedPitch()
pointSize() (see below)
weight()
style()
I happen to work with Qt last year and i used qml for building the UI part of my application.
Qt itself prefers us to use qml for building UI, since they have written a UI engine that renders everything better compared to the old engines.
In case of PyQt you are using the python only approach which is only not usually recommended, i am not saying that the qml version is pixel perfect. it still works bad at drawing curves (but that is not the stuff we usually require). As far as your problem is concerned qml will work fine for you (it has much better text rendering).
You might struggle a bit finding the learning resource for qml. But at least give it a shot and yes it is easier much easier than Python only approach.

Small icons in ParaView, Surface pro 6 Linux

I am new to Linux. I am running Linux in surface pro 6, the display resolution and everything is good except Paraview. I tried to change some settings in ParaView and font size was better now but the icons in the GUI were too small. I came through some posts in the Gitlab, but none of them is clear to a newbie. Can someone help me with this with a clear solution, please?
Thanks in advance.enter image description here
By Mathieu Westphal
Bug in Qt, work around is : QT_AUTO_SCREEN_SCALE_FACTOR=0 ./bin/paraview
https://gitlab.kitware.com/paraview/paraview/issues/19751

Fonts appearing abnormally large in IE7

I have the following specified on body:
body {
font: 63.5% Helvetica, Arial, sans-serif;
In Virtual Machines, I am unable to setup an IE7 installation to reproduce this problem, but on others' machines, some with IE7 render the font on the page abnormally large. The actual CSS and html are hundreds of lines long across multiple files, but I'm at a loss as to why only CERTAIN IE7 environments would produce this behavior.
Any thoughts on where I should be looking?
Zoom is 100% and text-size is medium. Although text-size IS medium, setting the text-size to anything larger than medium on my machines and VMs produces the same exact problem: overlapping text and images. Hmmm....
Display size in windows is set to normal (96dpi)
The following article was helpful for me:
http://www.lealea.net/blog/comments/web-dev-problem-win-ie-on-widescreen/
Basically IE has a "feature" for some screens (likely dell) that messes up how certain pages render. The fix has to do with turning off this feature via registry.
You can try it with the following command (start -> run):
reg add “HKCU\Software\Microsoft\Internet Explorer\Main” /v UseHr /t REG_DWORD /d 0×00000000 /f
Dell screws with font installations, for some reason, and will fuss up a number of fonts if any "Dell software" is installed.
This is a bit of shot in the dark, but you could check what the Text Size is set to in IE. If you go View Menu > Text Size and reset it to Medium.
Wild guess, but it might have something to do with the DPI setting. I'm pretty sure IE7 is using that setting, and if that setting is not the same on all your environments that might explain your problem.
On Windows XP you change it by going to Desktop -> Properties -> Settings -> Advanced
Here you can chose between normal size (96 dpi) and large size (120 dpi).
Do the users have a differet text size set?
(source: microsoft.com)
I ran into this problem lately, and it turned out that it was due to text size.

Resources