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
552
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
  • 42,465
  • 38
  • 114
  • 143
538
votes
17 answers

Change color of PNG image via CSS?

Given a transparent PNG displaying a simple shape in white, is it possible to somehow change the color of this through CSS? Some kind of overlay or what not?
user429620
512
votes
21 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
  • 7,240
  • 8
  • 31
  • 38
498
votes
24 answers

img src SVG changing the styles with CSS

html Logo css .logo-img path { fill: #000; } The above svg loads and is natively fill: #fff but when I use the above css to try change it to black it doesn't change, this is my first time playing with…
ngplayground
  • 16,883
  • 32
  • 91
  • 160
466
votes
19 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
  • 29,612
  • 37
  • 126
  • 201
463
votes
16 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
  • 13,093
  • 16
  • 63
  • 116
434
votes
20 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
  • 4,683
  • 3
  • 16
  • 9
431
votes
18 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
  • 5,926
  • 9
  • 33
  • 51
421
votes
25 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
  • 10,601
  • 18
  • 66
  • 105
418
votes
10 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
  • 21,435
  • 12
  • 29
  • 36
417
votes
12 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
  • 6,726
  • 22
  • 54
  • 67
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
  • 5,698
  • 6
  • 24
  • 27
380
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,228
  • 9
  • 35
  • 48
379
votes
15 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
  • 6,892
  • 8
  • 31
  • 44
376
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
  • 9,487
  • 12
  • 61
  • 89