Why is flutter not showing image on Android device - image

I have setup image assets like this:
/assets/images/img1.png
/assets/images/2.0x/img1.png
/assets/images/3.0x/img1.png
/assets/images/2.0x/img2.png
/assets/images/3.0x/img2.png
Then Image.asset('assets/images/img1.png') is displayed, but Image.asset('assets/images/img2.png') is not.
in pubspec.yaml assets defined like this:
assets:
- assets/images/
My question is do I have to add the /assets/images/img2.png ?
If yes, then why? because the device is not 1x resolution. Probably 2x or 3x.

You are missing asset for /assets/images/img2.png
Just resize img2.png by 50% and put img2.png in /assets/images/

Could you please tell us what are you trying to achieve maybe you just need to add one image and using in a boxDecoration in a Container but if you add to you question what exactly want to do, our answer its gonna help you more.

Related

Changing the name of a picture makes the picture looks small

I have a picture. I call it Publictransportation.
It looks smaller than it should be. It looks fine on simulator. But it looks small on iPhone.
I clean build. Delete the application. No luck.
Then I change the pic to Publictransportation1
Now it looks normal.
When I change back it looks small again.
There has to be some false cache. But where?
May be there are two images like one Publictransportation.png present in resources and another one will be just reference of Publictransportation.png, which might me there on your machine.
Search Publictransportation.png in your project and check for duplication.
I guess that you are using the device that has retina display, so you need to rename your picture with #2x in the end in order for the retina to take it as a double size, and from time to time try to clean your project an rebuild it again.

Provided og:image is not big enough

Since some days I'm experiencing this problem.
Here is my debug
The image provided is bigger than 200x200 px, it has unique link and there is any redirection on that page.
Linter response is 200.
When I copy and past page's link on fb it give me the choice between 3 images that are smaller than 200x200px and the one I've provided is ignored.
But If I try to share it through "Like button" or "Send button" it works fine.
It sounds like a fb Bug.
Thx
I solved using informations from this and this posts.
You can try using an image that is bigger than 200x200, with dimensions multiple of 100, and squared.
Other useful stuffs are using jpg extension, host the image in the same server of the website and avoid any "strange" chars in filename.
I tried many of the suggestions on this post and others to no avail. The thing finally worked for me (which I have not seen elsewhere) was to add the correct prefix to the element which I previously was missing entirely.
<head prefix="og: http://ogp.me/ns#">
Not sure if that actually fixed the problem for good or it just jogged the debugger into re-scanning the image (properly) but hopefully it helps someone else.
I got it done by renaming the image and the og:image url. Give it a try.
I have been struggling with this for a while too. I have tried all shapes and size for the image, renaming it, adding specific og:image:height and :width tags, etc.
The way I 'solved' it is just putting the image I want to show up in the website's root directory and point in og:image to another (1500x1500, btw) image. Facebook linter then tells me that it will use the image in the root directory. And that just works fine ;-)
Even if your image size is not in multiples of 100, it should work if your image is in jpg or jpeg format.
If your image is in png format, no matter what the size is, it will not work. This is based on my tests only. I would like to hear from other devs here.
I use png's all the time. I always use 1920 x 1080 because they look so good on Facebook shares. 85% of the time they work, sometimes they don't. Sometimes I delete and reload the same photo without renaming or changing a thing and it all of a sudden works. I'm not a real dev so that's all I can offer.
I tried most of these suggestions - double-checked the <head> prefix, tried adding the javascript sdk, tried square images, sourcing from different locations, simplifying the file name...
What finally worked was making sure an <img> tag for the same image appears in the body! I hid it with CSS / inline style.

How to add a colored filter effect on an image?

I am building an Eclipse RCP application, based on eclipse 3.5.
I'd like to modify an image at runtime. The image is loaded and will be used as an icon, but depending on the situation, I'd like to add a filter on the image to give it a red or orange color, depending on some user-configured value.
It's the image transformation that I'm interested in. I already know how to get the image and ask a component to display it.
Has anybody done that? Thanks for your help :)
There are possibly many choices for doing just that, you can use ImageIO to load an image as BufferedImage and then get the Graphics2D and modify it as you wish. When you are finished modifying you can reaasign the newly created image back into your component which holds the original image and thats it.
You can of course look for some libraries to allow you easier image manipulation, maybe jmagick or something similar.
You can use DecoratingLabelProvider with a suitable ILabelDecorator. See also FAQ What is a label decorator?

How does facebook handle resizing of images

Hello I am building a social network similar to facebook and I really need some help on how to handle the images in my website. I would like to know how sites like facebook manage the resizing of their images. An example would be looking at someones photo album. The length and width are not just simply changed. They are done in a more professional way to make the image still look clear and not stretched. Do they use a special tool for this. Another example would be profile pics when they are loaded to your message wall. Your friends profile pics are centered and cropped accordingly and then re sized. How do they go about doing this. Any help would be greatly appreciated.
They resize proportionally with an imaging library like GD, Imagick or others.
The presentation in the gray area is just that, presentation so HTML and CSS.
They stretch the images proportionally so that they don't look wrong; if you make the image 37.5% wider... you also make it 37.5% taller.
If we knew what language you are familiar with, we could probably suggest something to help with this.

iPhone images display

I want to know if there is any way to append something like white border around iPad image thumbnails without too much performance issues?
Something like in XHTML\CSS where you get Polaroid like appearance.I think you may have got faint idea.
Any guidance is highly appreciated.
Fastest way would be to draw a frame around your images if they're all of the same size (your thumbnails).

Resources