Questions tagged [image]

The image tag is for questions related to the loading, formatting, saving, compression, and display of images in the context of source code. This tag should also be used for assistance using various image libraries. Questions about specific image formats should include the tags for those formats. Include tags to mention if the question relates to format conversion, processing, etc.

The image tag is for questions related to the loading, formatting, saving, compression, and display of images in the context of source code. Images are typically rendered as a two dimensional matrix of pixels for the case of gray-scale images, or a multidimensional matrix of pixels in the case of color images (, , etc). These may be stored in a variety of formats such as , , , , , and others (See Image file formats for further information).

Where appropriate, include tags that classify the type of question, such as , , etc.


References

105595 questions
351
votes
14 answers

How to add an image to a JPanel?

I have a JPanel to which I'd like to add JPEG and PNG images that I generate on the fly. All the examples I've seen so far in the Swing Tutorials, specially in the Swing examples use ImageIcons. I'm generating these images as byte arrays, and they…
Leonel
  • 26,575
  • 25
  • 73
  • 95
347
votes
8 answers

Get image data URL in JavaScript?

I have a regular HTML page with some images (just regular HTML tags). I'd like to get their content, base64 encoded preferably, without the need to redownload the image (ie. it's already loaded by the browser, so now I want the content). I'd…
Detariael
  • 3,862
  • 4
  • 17
  • 10
336
votes
18 answers

Setting WPF image source in code

I'm trying to set a WPF image's source in code. The image is embedded as a resource in the project. By looking at examples I've come up with the below code. For some reason it doesn't work - the image does not show up. By debugging I can see that…
Torbjørn
  • 6,079
  • 4
  • 26
  • 41
333
votes
7 answers

How do I get the picture size with PIL?

How do I get a size of a pictures sides with PIL or any other Python library?
I159
  • 24,762
  • 27
  • 88
  • 124
326
votes
17 answers

How to resize an Image C#

As Size, Width and Height are Get() properties of System.Drawing.Image; How can I resize an Image object at run-time in C#? Right now, I am just creating a new Image using: // objImage is the original Image Bitmap objBitmap = new Bitmap(objImage,…
inutan
  • 9,740
  • 25
  • 74
  • 119
324
votes
8 answers

How to convert a PIL Image into a numpy array?

Alright, I'm toying around with converting a PIL image object back and forth to a numpy array so I can do some faster pixel by pixel transformations than PIL's PixelAccess object would allow. I've figured out how to place the pixel information in a…
akdom
  • 28,041
  • 24
  • 70
  • 79
316
votes
5 answers

How to make an app's background image repeat

I have set a background image in my app, but the background image is small and I want it to be repeated and fill in the whole screen. What should I do?
virsir
  • 14,359
  • 23
  • 71
  • 108
313
votes
20 answers

Saving a Numpy array as an image

I have a matrix in the type of a Numpy array. How would I write it to disk it as an image? Any format works (png, jpeg, bmp...). One important constraint is that PIL is not present.
M456
  • 4,449
  • 2
  • 17
  • 14
312
votes
9 answers

How to convert an image to base64 encoding?

Can you please guide me how can I convert an image from a URL to base64 encoding?
Volatil3
  • 11,721
  • 33
  • 112
  • 218
311
votes
18 answers

Capture Image from Camera and Display in Activity

I want to write a module where on a click of a button the camera opens and I can click and capture an image. If I don't like the image I can delete it and click one more image and then select the image and it should return back and display that…
Harsha M V
  • 50,335
  • 109
  • 326
  • 496
303
votes
8 answers

How to generate a Dockerfile from an image?

Is it possible to generate a Dockerfile from an image? I want to know for two reasons: I can download images from the repository but would like to see the recipe that generated them. I like the idea of saving snapshots, but once I am done it would…
user1026169
  • 4,067
  • 5
  • 17
  • 25
295
votes
14 answers

jQuery callback on image load (even when the image is cached)

I want to do: $("img").bind('load', function() { // do stuff }); But the load event doesn't fire when the image is loaded from cache. The jQuery docs suggest a plugin to fix this, but it doesn't work
Tom Lehman
  • 75,197
  • 69
  • 188
  • 262
295
votes
7 answers

CSS3 Rotate Animation

Cannot get this animated image to work, it is supposed to do a 360 degrees rotation. I guess something's wrong with the CSS below, as it just stays still. .image { float: left; …
Nikk
  • 5,862
  • 5
  • 30
  • 61
292
votes
10 answers

Get content uri from file path in android

I know the absolute path of an image (say for eg, /sdcard/cats.jpg). Is there any way to get the content uri for this file ? Actually in my code, I download an image and save it at a particular location. In order to set the image in an ImageView…
pankajagarwal
  • 12,942
  • 14
  • 50
  • 64
291
votes
22 answers

Inputting a default image in case the src attribute of an html is not valid?

Is there any way to render a default image in an HTML tag, in case the src attribute is invalid (using only HTML)? If not, what would be your lightweight way to work around it?
Galilyou
  • 9,817
  • 13
  • 50
  • 67