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
664
votes
25 answers

Convert an image to grayscale in HTML/CSS

Is there a simple way to display a color bitmap in grayscale with just HTML/CSS? It doesn't need to be IE-compatible (and I imagine it won't be) -- if it works in FF3 and/or Sf3, that's good enough for me. I know I can do it with both SVG and…
Ken
  • 7,052
  • 3
  • 18
  • 8
634
votes
21 answers

How to make layout with rounded corners..?

How can I make a layout with rounded corners? I want to apply rounded corners to my LinearLayout.
Addy
  • 6,363
  • 3
  • 14
  • 13
622
votes
23 answers

How do I resize an image using PIL and maintain its aspect ratio?

Is there an obvious way to do this that I'm missing? I'm just trying to make thumbnails.
saturdayplace
  • 8,370
  • 8
  • 35
  • 39
602
votes
14 answers

What are the different usecases of PNG vs. GIF vs. JPEG vs. SVG?

When should certain image file types be used when building websites or interfaces, etc? What are their points of strength and weakness? I know that PNG & GIF are lossless, while JPEG is lossy. But what is the main difference between PNG & GIF? Why…
Faruz
  • 9,909
  • 10
  • 48
  • 66
577
votes
19 answers

Android: combining text & image on a Button or ImageButton

I'm trying to have an image (as the background) on a button and add dynamically, depending on what's happening during run-time, some text above/over the image. If I use ImageButton I don't even have the possibility to add text. If I use Button I can…
znq
  • 44,613
  • 41
  • 116
  • 144
555
votes
18 answers

CSS Image size, how to fill, but not stretch?

I have an image, and I want to set it a specific width and height (in pixels) But If I set width and height using css (width:150px; height:100px), image will be stretched, and It may be ugly. How to Fill images to a specific size using CSS, and not…
Mahdi Ghiasi
  • 14,873
  • 19
  • 71
  • 119
532
votes
22 answers

Formula to determine perceived brightness of RGB color

I'm looking for some kind of formula or algorithm to determine the brightness of a color given the RGB values. I know it can't be as simple as adding the RGB values together and having higher sums be brighter, but I'm kind of at a loss as to where…
robmerica
  • 5,663
  • 3
  • 18
  • 9
485
votes
19 answers

How to embed image or picture in jupyter notebook, either from a local machine or from a web resource?

I would like to include image in a jupyter notebook. If I did the following, it works : from IPython.display import Image Image("img/picture.png") But I would like to include the images in a markdown cell and the following code gives a 404 error…
Ger
  • 9,076
  • 10
  • 37
  • 48
478
votes
20 answers

Can an ASP.NET MVC controller return an Image?

Can I create a Controller that simply returns an image asset? I would like to route this logic through a controller, whenever a URL such as the following is requested: www.mywebsite.com/resource/image/topbanner The controller will look up…
Jonathan
  • 32,202
  • 38
  • 137
  • 208
464
votes
23 answers

Why does an image captured using camera intent gets rotated on some devices on Android?

I'm capturing an image and setting it to image view. public void captureImage() { Intent intentCamera = new Intent("android.media.action.IMAGE_CAPTURE"); File filePhoto = new File(Environment.getExternalStorageDirectory(), "Pic.jpg"); …
Shirish Herwade
  • 11,461
  • 20
  • 72
  • 111
463
votes
9 answers

How do I convert a PIL Image into a NumPy array?

How do I convert a PIL Image back and forth to a NumPy array so that I can do faster pixel-wise transformations than PIL's PixelAccess allows? I can convert it to a NumPy array via: pic = Image.open("foo.jpg") pix =…
akdom
  • 32,264
  • 27
  • 73
  • 79
447
votes
23 answers

Refresh image with a new one at the same url

I am accessing a link on my site that will provide a new image each time it is accessed. The issue I am running into is that if I try to load the image in the background and then update the one on the page, the image doesn't change--though it is…
QueueHammer
  • 10,515
  • 12
  • 67
  • 91
443
votes
12 answers

Image comparison - fast algorithm

I'm looking to create a base table of images and then compare any new images against that to determine if the new image is an exact (or close) duplicate of the base. For example: if you want to reduce storage of the same image 100's of times, you…
meade
  • 22,875
  • 12
  • 32
  • 36
440
votes
11 answers

Saving image from PHP URL

I need to save an image from a PHP URL to my PC. Let's say I have a page, http://example.com/image.php, holding a single "flower" image, nothing else. How can I save this image from the URL with a new name (using PHP)?
riad
  • 7,144
  • 22
  • 59
  • 70
440
votes
19 answers

Responsive image align center bootstrap 3

I do a catalog using Bootstrap 3. When displayed on tablets, the product images look ugly because of their small size (500x500) and a width of 767 pixels in the browser. I want to put the image in the center of the screen, but for some reason I can…
Konstantin Rusanov
  • 6,414
  • 11
  • 42
  • 55