NSImageView - scaling image down loses sharpness - cocoa

I am trying to render a few images in NSImageView's. These images are much larger than the size of the NSImageView (which I have set to scale proportionally up or down). But, the rendered image don't look very good. For example, in this sample image, the white border seems to have jagged edges at the 12,3,6 and 9 o'clock positions. The source image seems to be fine, even when I zoom out all the way in Preview.app.
I have tried scaling the image myself (using MGCropExtensions - which sets the interpolation quality to High), but, it doesn't seem to help. I would imagine NSImageView would internally draw on device boundary automatically, so that shouldn't be an issue?
Any ideas on how to get the image rendered crisply in the NSImageView? Thanks
Source Image - It has a white border which doesn't show here (against the white background)
Rendered NSImageView screenshot

Related

Xcode Image Slicing Not Working with Gradients?

I have PNG images with rounded corners, inner shadows and a fill gradient, that I thought I could slice in Asset Catalogs horizontal and vertically. But no matter what I try, the gradient slice doesn't stretch or tile as I expected. With Xcode 9.1.
The gradient is not copied (although the inner shadow is), and in IB and the simulator, there are just two bars and no gradient.
What am I missing?
Here are the original image:
Here's how I sliced them:
And what they looked like in IB:
And here's what it looks like in IB (with the colors reversed in the simulator (with a red view and another similar image as background without any gradient) and device.
The center is the part that is getting tiled. You defined a 1x1 square that’s getting repeated on the interior of your image in order to make the image fill the space you defined, which isn’t your stated goal. What you can do is change your center to Stretches, and increase the center’s height and width to take up everything in your image that doesn’t include your rounded corners end caps.

How to keep sprite border the same size when scaling sprite in Unity?

I've created an image in Photoshop to be used as a sprite in Unity and everything works fine while the sprite is scaled at X: 1; Y: 1.
The problem starts when I scale the image up as the border of the image stretches out with the rest of the image. Is there any way to scale an image from its centre or to ignore the image's border when it's scaled?
Here's the example now that I am able to show it:
The rectangle on top is the original image without being scaled up or down and the rectangle on the bottom is scaled at X:5, Y:0.5 but the borders are stretched.
I think that the borders are stretched because it's part of the image and when it's being scaled, the image (including the borders) is just being stretched.
Is there any way to stretch the sprite image but by ignoring the borders?
Are you trying to scale the image and keep the original ratio?
If so, here are the steps:
Hope this helps. Please let me know if you were trying to do something else.
You can use a sliced sprite. The center of the image is scaled to fit the control rectangle but the borders maintain their sizes regardless of the scaling. Check out the Unity doc here: Unity - Manual: Image

Image map re-sizing

I have been looking to dynamically scale a image map with coordinates to a div, so when re-sizing a window occurs the map and all coordinates are scaled accordingly.
any suggestions on how to do this?
i think this may work
http://blog.outsharked.com/p/image-map-resizer.html
but with the alternate option of :enter a bounding area and the map will be clipped to within that area.
my question then is how do i establish a bounding area, will it scale dynamically to that whole area?
This jQuery plugin works great for scaling and rescaling image maps on the fly. You can call this once, and it will take care of all image maps on the page. It will even rescale an image map if something happens that changes an image's dimensions.
https://github.com/stowball/jQuery-rwdImageMaps.
If you weren't just using the div to solve the image map scaling problem, you could put a blank image (a completely transparent .gif or .png) in your div with the image map applied to it and set its width and height to 100%.

Zoom a large image in IKImageView

I have an IKImageView in NSScrollView.
Now, I have two problems:
When I show a large image and zoom it, the animation loos very crappy. Is there a way to get it to switch images more smoothly?
When the image is zoomed bigger then the IKImageView, zoom - centerPoint lock on left - bottom of IKImageView. How can I set the zoom - centerPoint?
Thanks
f91kdash

Inserting Images on the Custom UI Editor

I'm using the custom UI editor to upload images to a custom ribbon tab. I need the images to look like this:
but currently they are looking like this:
These images are directly from Microsoft shapes. I tried saving them the shapes directly but they were really messy. There must be a way to get the shapes perfect as per the first image - I'm just not sure how.
Any help would be appreciated.
Your images need to be saved in exactly 16x16 pixel size. Anything else, and they will be scaled to fit a 16x16 area, and thus have fuzzy lines.
Your top image (the rectangle) measures 16 pixels wide by 10 pixels tall. If that is the extent of that image, then when you import it, it will get stretched. You need to also include the white (or empty) space around the image (in this case, above and below) when you create the image.
The example above shows the exact same 16x10 px rectangle, in two different formats. The top image included the white space above and below the rectangle and was saved as a 16x16 px image. The bottom image only had the 16x10 px rectangle and was saved as a 16x10 px image, so it was stretched by the UI editor to fit the 16x16 available space.

Resources