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

113505 questions
433
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
  • 29,741
  • 31
  • 97
  • 132
424
votes
21 answers

CSS Display an Image Resized and Cropped

I want to show an image from an URL with a certain width and height even if it has a different size ratio. So I want to resize (maintaining the ratio) and then cut the image to the size I want. I can resize with html img property and I can cut…
InfoStatus
  • 6,983
  • 9
  • 41
  • 53
419
votes
24 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
  • 5,547
  • 2
  • 19
  • 14
419
votes
19 answers

How to do Rounded Corners Image in Flutter

I am using Flutter to make a list of information about movies. Now I want the cover image on the left to be a rounded corners picture. I did the following, but it didn’t work. Thanks! getItem(var subject) { var row = Container( margin:…
Liu Silong
  • 4,902
  • 3
  • 19
  • 28
415
votes
56 answers

Storing Images in DB - Yea or Nay?

So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think are the pros/cons?
James Hall
  • 6,469
  • 6
  • 27
  • 28
392
votes
11 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
  • 5,345
  • 5
  • 21
  • 35
376
votes
9 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
  • 4,152
  • 4
  • 19
  • 10
367
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 are…
Leonel
  • 28,541
  • 26
  • 76
  • 103
366
votes
9 answers

How to convert an image to Base64 encoding

How can I convert an image from a URL to Base64 encoding?
Volatil3
  • 14,253
  • 38
  • 134
  • 263
364
votes
19 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,423
  • 5
  • 29
  • 42
362
votes
9 answers

How to create a video from images with FFmpeg?

ffmpeg -r 1/5 -start_number 2 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4 This line worked fine but I want to create a video file from images in another folder. Image names in my folder are: img001.jpg img002.jpg img003.jpg ... How…
user3877422
  • 3,687
  • 3
  • 13
  • 6
358
votes
11 answers

How do I convert a numpy array to (and display) an image?

I have created an array thusly: import numpy as np data = np.zeros( (512,512,3), dtype=np.uint8) data[256,256] = [255,0,0] What I want this to do is display a single red dot in the center of a 512x512 image. (At least to begin with... I think I can…
jlswint
  • 3,683
  • 2
  • 16
  • 4
357
votes
16 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
  • 10,558
  • 27
  • 84
  • 126
348
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
  • 7,384
  • 8
  • 44
  • 90
346
votes
27 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?
Ahmed
  • 11,063
  • 16
  • 55
  • 67