Auto Resizing Image - lightbox2

Lightbox2 is auto resizing the image in my lightbox to a maximum of 274 pixels wide and is stretching the height. I set the option to 1500 pixels wide with the options method but it does not fix this. I want the full image to show in the lightbox not some smaller and stretched version. Anyone know a fix or if this plug in is just broken?

To make your images expand to their full resolution, you will have to modify two files. Go to ../lightbox/js
Open lightbox.js and change
fitImagesInViewport: true,
to
fitImagesInViewport: false,
and save.
Then open lightbox.min.js and change
fitImagesInViewport: !0,
to
fitImagesInViewport: !1,
and save.
All images will show on full res instead of being downsampled to the viewscreen size.
I asked Lokesh to add a option that will show a little magnifier when the image has been downsampled so that the reader will see the full res image when clicking on it, but I'm not sure he will/can implement this, nor when.

Related

how to scale an image with gimp and save the actual scale and all the white space

there are a ton of scaling instructions for GIMP but all of them tell you to scale and save easy peasy. I feel like I'm taking crazy pills.
This is what my save or export generates:
How can I simply export a selection? Shouldn't the GIMP instructions include this detail? Sorry for ranting.
In Gimp (and some other popular image editors) the image you work on is actually made of separate images (a.ka.a layers) held together on a "canvas". The "canvas" gives the size of the final image.
There are three different ways to scale things and you have to use the right one:
The Scale tool : scales the active layer by dragging corners. Doesn't change the size of the canvas. This is probably what you used.
Layer>Scale layer: scales the active layer by providing explicit dimensions. Doesn't change the size of the canvas.
Image>Scale image: scales the whole image contents and the canvas. This is probably what you should have used.
What happened to give you the image above is that you resized the layer using the Scale tool, so you got a tiny image in the corner of the canvas, which didn't change size. The uncovered part of the canvas was displayed as a checkerboard pattern. If you exported to a format that supports transparency such as PNG or GIF the image would have been transparent, but since you exported to JPG which doesn't support transparent images Gimp replaced the transparent part by the default background color.
Everything is well explained on their website. https://www.gimp.org/tutorials/GIMP_Quickies/

How ImageResizer Dynamically change image resolution based on screen size

I am using ImageResizer to resize the images and display on the bootstrap layout.
Here I am fixing the image sizes while retrieving them to display the sizes in URL.
Issue is, image quality is lost as dimensions are different for different screen sizes and I am unable to adjust the image which is retrieved to fit exactly to the screen size.
Eg: for 14 inch monitor if size of image is 300*300 which gives perfect quality image, if the same image is viewed in 21 inch monitor the 300*300 image retrieved from imageresizer is loosing quality and getting blurred.
Can some one say what is best solution to retrieve images?
Thanks in advance.
Praveen.
Slimmage.js offers automatic resolution and dpi-switching using the ImageResizer URL API. It is probably the easiest way to achieve what you are looking for, as you just install it and set a CSS max-width on images. Done.
Why this is a problem (like Amy says in the first comment):
Because of high-density displays, browser pixels and screen pixels are not 1-1. Thus you need to use a images-swapping technique like srcset, picture, or Slimmage.js. srcset and picture require polyfills to work on older browsers.

Image displaced or absent with ImageViewer

Using the designer. My form has a layout BoxLayoutY. I just drop the ImageViewer in it. I have a pic added through "Add Picture", which is 1080 x 1400. I add it to the ImageViewer.
The "Simulate Device" command gives, in iPhone3:
And in Nexus (the pic below is static: can't be scrolled up or down):
Help?
I have installed the app locally on my Android and I get the same half cut pic as in the screenshot of the Nexus simulator.
The overal goal is to have a single form, scrollable vertically, showing pics (adjusted at the width of the screen) and text.
EDIT:
Could be a problem with the resolution of the pic. I decrease the res to 350 x 467 and it displays fine. So it will pixelize or won't scale to fit the width of the screen on larger devices?
The image viewer doesn't have a preferred size since it doesn't have an image in it. Its designed for usage full screen or within a predetermined layout. If you place it in the center of a border layout it will take up available space and work as expected.
Since it scales the image and allows manipulation of that images size, its size is flexible. If you want a component that takes up the exact image size you should use a Label.
Ok got it!
What I was doing wrong was that I had:
MainForm (in a BoxY layout)
-> a container nested in it (in Borderlayout)
---> an ImageViewer nested at the center of it.
This produced the effect above (half cut pic).
Instead, what achieved a properly sized pic was:
MainForm (in a BorderLayout).
-> The ImageViewer nested at the center of it. That's it, no container.

Icon size help WINAPI only showing small c

Hi there just a quick question I hope someone can help me with I am loading a logo onto my dialog application into a static picture holder using the .rc file and adding this code.
ICON IDI_MYICON,IDC_STATIC_IMAGE,120,154,21,20
However my problem is this will only display a 64x64 image max and the banner I have loaded is 242x74 in size am I using the wrong method in using ICON? I did try bitmap but didnt work either.
Thanks
The 21,20 in your statement is the width and height of the icon control in dialog units. Dialog units vary depending on things like screen DPI and the font selected. There are typically 2-4 pixels per dialog unit. You've basically given the icon something on the order of 64x64 to display in.
To get the icon control sized pixel-perfectly, you can to resize it dynamically, e.g., during WM_INITDIALOG.
Also, I'm not sure which method the dialog box code uses to load the icon--some (like LoadIcon) restrict the size to a "standard" size which others (like LoadImage) do not.

Button image too far from top of button; too close to bottom of button

I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low on the button, such that the bottom of the icon is almost right on the bottom of the button and there is a lot of space above the image.
Here is a screenshot:
Button Screenshot http://www.freeimagehosting.net/uploads/b28a5c63b8.jpg
See how the corner of the icon is brushing up against the bottom of the button?
My button is 23 pixels high and the image is a 16 x 16 icon (converted to a bitmap so that it can be assigned to the button's Image property).
I've tried setting the button's Margin.All property to 0, and verified that the Padding.All property is 0. I've also tried changing the button's ImageAlign to TopLeft, MiddleLeft, and BottomLeft, but none of those settings seem to have any affect.
Does anyone know how I can position the image to be of equal distance from the top and bottom edges of the button? I can resize the button or the image if necessary but they are at my preferred size and I would like to keep them that way if possible.
I just encountered a similar problem, which I was able to solve by thinking really hard. (Ain't those situations great?)
The explanation
First it's important to understand that ImageAlign does NOT mean where on the button do you want the image. It means what point (pixel) on the image should be used for positioning. So if you pick "TopLeft", then the top-left-most pixel of the image will be vertically CENTERED on the button.
The problem comes in when you have a button with a centered image, whose ImageAlign is set vertically to "center", and whose dimensions are of an even number of pixels. Your image is 16x16 pixels- 16 is an even number. The middle pixel would theoretically be somewhere between pixel 8 and pixel 9. Since there is no pixel 8.5, VB rounds down to 8, thereby using pixel 8 as your positioning pixel. This the root cause of your unwanted upper margin.
Your button has an odd pixel height (23px) which means it has a true center pixel- pixel 12. VB tries to position the image's center pixel (8) on top of the button's center pixel (12). This puts 8 of the image's pixels BELOW center, and 7 pixels ABOVE center. To even things out, a 1-pixel margin appears above the image.
The solution
Pad the image with 1 extra row of pixels on the bottom. The image now has a height that's odd (17 px), giving the image a true center pixel which can line up perfectly with the button's center pixel.
That's how I solved the problem for myself. However, a simpler possible solution just occurred to me. You could probably achieve the same result by assigning the image a bottom margin of 1px. I have not tested this solution but it seems theoretically equivalent to the first solution.
Additional note: Two objects of EVEN dimensions should theoretically be able to center-align perfectly. But strangely enough, the alignment problem occurs even if the button AND the image BOTH have even dimensions. (Apparently the compiler is not consistent in the way it determines the center pixel of one control vs another.) Nonetheless, in this case, the same solution applies.
Typically, we'll set the following properties (for an image on the right, for example):
ImageAlign: MiddleRight
TextAlign: MiddleLeft
You'll want to align both the text and image in a similar fashion. Outside of that, make sure that you are setting the Image property, not the BackgroundImage property and make sure you are doing the icon to plain bitmap conversion properly. Have you tried a plain bitmap file?
Just a question: are you positive that the bitmap contains no information on the top of the note image? I have had that happen to me more than once where a crop looked right in Photoshop and came out incorrect in the live code... :)
If that were the case your code may be perfect ;)

Resources