imageio.IIOException: Can’t read input file

Have you tried using new File(“logo.jpg”); (without the leading /)? And are you sure, the logo.jpg is copied to your output? (Some IDEs don’t copy every file from your source-directories to your output (or target) directories.) becomes (Note that the IDE/compiler does not copy the image to your output-directory and so the compiled code cannot … Read more

Resizing image in Java

If you have an java.awt.Image, rezising it doesn’t require any additional libraries. Just do: Ovbiously, replace newWidth and newHeight with the dimensions of the specified image.Notice the last parameter: it tells to the runtime the algorithm you want to use for resizing. There are algorithms that produce a very precise result, however these take a large time to complete.You can use any of the following … Read more

Specifying width and height as percentages without skewing photo proportions in HTML

Note: it is invalid to provide percentages directly as <img> width or height attribute unless you’re using HTML 4.01 (see current spec, obsolete spec and this answer for more details). That being said, browsers will often tolerate such behaviour to support backwards-compatibility. Those percentage widths in your 2nd example are actually applying to the container your <img> is in, and not the image’s actual size. Say you … Read more

Change color of PNG image via CSS?

You can use filters with -webkit-filter and filter: Filters are relatively new to browsers but supported in over 90% of browsers according to the following CanIUse table: https://caniuse.com/#feat=css-filters You can change an image to grayscale, sepia and lot more (look at the example). So you can now change the color of a PNG file with filters. Source

display variable image using cookies

Have you considered using PHP instead? I feel that it would be a lot more straightfoward. Use setcookie and then simple if and elseif statements to check what the cookie is, and display a corresponding image. This seems a lot simpler than what you’re trying to do with JavaScript, but maybe that’s just because I use PHP … Read more