Inkscape Inquiry: Why my defined page dimensions won't visually match an imported image? - inkscape

.. of the same dimensions?
The imported image at 2048x2048 looks larger than the page defined at the SAME dimensions (in the Custom size area). It makes no sense.

In the image import dialog, Inkscape asks you for the dpi value it should use for the raster image. Use the defult import resolution after making sure it is set to 96 dpi for Inkscape >= 0.92 (90 for older versions) in Edit > Preferences > Bitmaps (or Edit > Preferences > Imported Images in Inkscape 1.0), to have the pixels match those in Inkscape.

Related

Display Image without loosing quality

I am using QSplashScreen to display a splash screen for my QtQuick 2 application. I am using a decent quality image (838 X 500). It displays correctly in some screen resolutions. But for some other resolutions like 2K resolution, it looks like some low quality transformation is applied.
Already tried Qt::SmoothTransformation
Connecting my laptop to my monitor (I have 2K monitor) and selecting 'Duplicate display' option in display management, produces low quality image. Selecting 'Second screen only' produces decent quality image.
QPixmap pixmap(qApp->applicationDirPath()+"/splash.png");
QSplashScreen splash(pixmap.scaledToWidth(screen_width*0.35,Qt::SmoothTransformation));
splash.show();
Is there a way to display an image without loosing the quality?
I am experiencing the same issue with 'Image' in QML.
If Qt is attempting to render the image at the same "physical" size on a higher resolution display, then it will have no choice but to upscale the image. You should provide a higher resolution image:
https://doc.qt.io/qt-5/scalability.html#loading-files-depending-on-platform
The target platforms might automate the loading of alternative
resources for different display densities in various ways. On iOS, the
#2x filename suffix is used to indicate high DPI versions of images.
The Image QML type and the QIcon class automatically load #2x versions
of images and icons if they are provided. The QImage and QPixmap
classes automatically set the devicePixelRatio of #2x versions of
images to 2, but you need to add code to actually use the #2x
versions:
if ( QGuiApplication::primaryScreen()->devicePixelRatio() >= 2 ) {
imageVariant = "#2x";
} else {
imageVariant = "";
}
Forget the part about iOS - I think it's outdated, because it has applied to all platforms for a while now.
So in your case, you should add a splash#2x.png that is twice the resolution (and detail) of splash.png. If you're just using QPixmap, you will need to add the code above to ensure the correct image variant is selected. If you're using QML's Image type, it will select it automatically.

Is it possible to use OpenCV TemplateMatching with a patch images dimensions or background color only?

I am using OpenCV on iOS to detect a rectangular label to assist users in snapping a photo of that label. I have an overlay that presents once the matches threshold is met.
My question is, does that patch image used have to be exact? The labels I am detecting have text on them that vary from label to label. All the same font but different characters. Is it possible to train OpenCV with a patch images color and/or size/dimensions? Or is there perhaps another way around this issue?
Here is a close example to the labels Im scanning, EXCEPT THERE ARE NO ICONS AND ALL ONE FONT TYPE.
Here is the tutorial I am following, which is achieved with an image of a target. http://www.raywenderlich.com/59999/make-augmented-reality-target-shooter-game-opencv-part-3

explorer thumbnails show with alpha glitches in windows 8+

I am showing thumbnails (in a WTL/ATL/C++ application) using IShellItemImageFactory. Everything works fine all the way up to windows 8. There, some icons come with some black lines where transparency should be. It is slight but visible: http://i59.tinypic.com/ru2vmf.png
It happens to a minority of icons only.
After extracting the bitmap I show it (exactly as returned by GetImage(SIIGBF_RESIZETOFIT)) in a standard static control with STM_SETIMAGE. The glitch is still there if I add the bitmap in an imagelist
what can be the problem?

Creating Launch Screen.xib for iOS8 ( ... iOS11, Swift 4 and LaunchScreen.storyboard )

I've just found out that in order to be able to have the description for your app in the app store say "This app is optimized for iPhone 6, and iPhone 6 Plus." you need to use a launch XIB or storyboard file for your launch images (per [Apple][1]).
So, I've created a new Launch Screen xib and now I'm a little but since I usually do everything in code and don't use interface builder. I've deleted the default label that is inserted and dropped a UIImageView into the view. Now I'm wondering how would I:
1) Tell the UIImageView to resize to the size of whatever screen it's on
2) Tell the UIImageView to pick ImageA if a 3.5 inch screen is running the app or the ImageB if a 4 inch screen is running the app etc. etc.
Essentially, I'm just trying to get the launch .xib to mimic the behavior of how the launch screen works normally. Would appreciate it if anyone could provide some assistance on this!
You have two options:
You make use of autolayout and give the imageview a fullscreen appearance (distance to top, bottom, left and right equals 0). This would however result in a clipping of the image for certain screen sizes, what you may not want. So you might want to consider (2)
You place the launch screen image into an asset catalog and just put different images into the different size classes.
I found the answer useful.
The old steps in short for creating the LaunchScreen xib for iOS 8 are below the new steps.
With reference to XCode 9, Swift 3 or Swift 4 and LaunchScreen.storyboard following are the new steps.
First step is to create two images for Portrait and landscape mode splash ( png or jpeg ) in your favorite graphic software. ( If your app only support Portrait mode, you may skip Landscape mode image and settings. )
Portrait mode image :-
Create a 'splash-portrait' image with your own full background for size of "width 1125 x height 2436". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 1125 x height 1471". This should always be in center of above full image.
Landscape mode image :-
Create a 'splash-landscape' image with your own full background for size of "width 2436 x height 1125". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 860 x height 1125". This should always be in center of above full image.
Once both the images are ready, you may add it to xcassets or keep in resource.
Now go for the following steps.
1) "LaunchScreen storyboard" is already created with the new project. Open it.
2) Add an Image View on the view.
3) Set the above saved 'splash-portrait' image to image view source.
4) Set Image view 'Content mode' of Image as "Aspect Fill".
5) Add 4 constraints of Image View for Top, Bottom, Trailing and Leading to Superview.
This is done for the portrait mode app splash.
For landscape mode support, do the following extra steps. ( you may refer full answer by #Sakiboy at
https://stackoverflow.com/a/46089856/2641380 )
6) Click the + button next to the Image view source that you set up in step 3.
7) From the pop-up that is now displayed select Regular for both the Width and Height selectors. This is specifying a new adaptive set for iPads that are in landscape. A new image source field will appear with the title wR hR. Add the 'splash-landscape' image to the wR hR Image source field so the storyboard knows to use a different image when in landscape.
8) Now we need to add support for the 'iphone plus' devices when in landscape. So click the + button next to the Image source field again.
9) This time select compact for the height and regular for the width selectors. This is specifying a new adaptive set for “iPhone plus” devices that are in landscape. A new image source field will appear with the title wR hC.
10) Add the “splash-landscape” image to the wR hC Image source field so the storyboard knows to use a different image when in landscape on an “iPhone plus device”.
As iPad devices are "Regular for both the Width and Height", We will see 'splash-landscape' image in iPad for both portrait and landscape mode. Width 860 for displayable content in 'splash-landscape' image will show full content in both portrait and landscape mode.
The old steps in short for creating the LaunchScreen xib for iOS 8.
1) create a new "LaunchScreen xib" from new file --> user interface --> launch screen ( keep auto layout ON ).
2) Add an image view in the xib --> view (main view).
3) set splash image to it ( the image should not be in assets file ).
4) set image as "Aspect Fit" ( if required ).
5) you may also change the "view" (super view) background color as close to background color of image.
6) select the image view, click from menu - editor - pin - bottom space to super view.
7) this will show red error mark near "view" ( super view of image view ).
8) click on the error mark, you will see approximate two auto layout errors.
9) on clicking on the error you will find menu with auto fix the layout errors.
10) on fixing the errors, you will find total four "Constraints" with "vertical" and "horizontal" space between superview and image.
11) now you may test them in different devices or simulators.
Regards.
You can resize the image by setting constraint to the top, bottom, leading and trailing edges of the superview. Just click the imageview and select Editor->Pin the top context menu. You can also set the aspects of the UIImageView by clicking it and setting it to for instance "Aspect Fit". Make sure the ImageView covers the whole screen before setting the constraints, or else you would have to modify the contstraints.
To set different images for different screen sizes, I would guess you have to create a class and modify to the viewWillAppear method to load an appropriate image
Good luck!
Erik
Create a new file. Under User Interface select View. After, you can name your xib LaunchScreen and you can test it out by adding a label with something like “Test Launch” and run the app. You should see the launch screen appear!
The Launch xib can't have a customized class since your app didn't launch when it is displayed.
What I ended up doing is:
use sizing class feature
Create 3 UI images (one per sizing class)
Use auto layout with constrains which apply to each sizing class
So when you display one type of device the width and hight constrains of the other two UIImageView are set to 0

In resources of a executable file, how does one find the default icon?

i need to find the default icon of a windows executable (PE file = dll, exe, com..) programatically. I do know how to walk throught the resources and identify what is an icon, what a cursor etc, but as far as i know none of the icons is in any way marked as the default one. So, does somebody know, how to find the default icon? Moreover, i do not want to use any windows api call, i want to code the function myself. The problem is that i don't know which one of all the icons is the default one.
After a lot of searching, i found out that the default icon is not the one with the lowest id.
Windows use several sizes of one icon for various things. For more information, look here, but in short here is the important information:
When the system displays an icon, it must extract the appropriate icon image from the .exe or .dll file. The system uses the following steps to select the icon image:
Select the RT_GROUP_ICON resource.
If more than one such resource
exists, the system uses the first
resource listed in the resource
script.
Select the appropriate RT_ICON image
from the RT_GROUP_ICON resource. If
more than one image exists, the
system uses the following criteria
to choose an image:
The image closest in size to the
requested size is chosen.
If two or more images of that size
are present, the one that matches the
color depth of the display is chosen.
If no images exactly match the color
depth of the display, the image with
the greatest color depth that does
not exceed the color depth of the
display is chosen. If all exceed the
color depth, the one with the lowest
color depth is chosen.
Note: The system treats all color depths of 8 or more bpp as equal. Therefore, there is no advantage of including a 16x16 256-color image and a 16x16 16-color image in the same resource — the system will simply choose the first one it encounters. When the display is in 8-bpp mode, the system will choose a 16-color icon over a 256-color icon, and will display all icons using the system default palette.
Since the requested size is 16x16 (because thats the system small icon size, ie. the default icon size) i think we can say that the default icon is the icon from the first icon group which has the smallest size (no smaller icon than 16x16 can exist) with the highest color depth.
EDIT: a small correction. A icon of size smaller than 16x16 might apparently be in the resources, but that indicates that the file does not have a default icon and the system then does supply its own icon instead.
The first one you find is the default one.
The default icon is simply the icon with the lowest id, so, by definition, is the first icon discovered when enumerating resources.