Hot answers tagged

15

How is it possible to reduce an image by 90% without losing quality? Formats and compression options There are three popular image storage formats for web (not counting the promising WebP), and each format has its own compression options. A clueless coder may pick the wrong format and use wrong options, resulting in less-than-optimal image quality and ...


12

I'm pretty sure they're generated on the fly based on a bunch of parameters. You'll note if you Inspect Element that the HTML for the tag includes some code : data-itemcode="BEH-PEN-01" Probably the initial base image to use. In this case, Pendent 01 data-angle="P" Angle probably specifies which version of the image to generate. For example, there are 4 ...


7

The advantage of a 8 bits per channel indexed PNG is its size. The disadvantage is that if the image contains more than 256 colors, the graphics editing program will try to adapt the palette, meaning that some colors will slightly vary. Some programs are smart to pick a well-adapted palette. Some are retarded. Don't use the last ones. For a subtle gradient,...


7

Most file system limits how many files you can have in a directory, which means you are forced to use subdirs anyway if the amount can grow indefinitely. Beware there is a limit on number of dirs as well (which is usually lower, say 32000 on ext3) If you can calculate the exact path to a file then there is no performance problem reading that file. Listing ...


7

I agree wholeheartedly with Tulains Córdova on the question of file paths, but can't disagree strongly enough about BLOBS. Although the question doesn't specifically mention if it's a web application or a more traditional client-server application, it sounds like we're talking about a web app from the context provided about USERS & PRODUCTS. If that's ...


6

First about storing file paths: Having several image path columns (imagepath1, imagepath2 ... imagepathN ) violates 1NF. Storing several comma-separated image paths in the same column also violates 1NF. When you violate the simplest of normal forms, you will have a lot of headaches in the future. The correct thing to do is create a separate table for images....


5

The question is one of scale, where it will be hosted, cost and management. If you know you are going to host in AWS, then you can take advantage of the distributed nature that makes the cloud more scalable. First Decision: Self Hosted vs the Cloud The old answers (circa 2014) reflect the mindset when self hosting was still predominant. However, there ...


4

What I've done in the past is use PaperClip with Amazon S3 and CloudFront CDN for faster delivery. PaperClip supports S3 storage very nicely out of the box: see their documentation for S3 storage configuration options. Set up a CloudFront distribution to forward image requests to your S3 bucket and other requests for static assets to your Ruby on Rails ...


4

I didn't read your link, but from your question... "Sum of absolute values of differences between adjacent pixels in that column": sum = abs(pix1 - pix2) + abs(pix2 - pix3) + ... You perform this computation for pixels 1 and 2 in the column, then 2 and 3, and so on. Do this for every column. Then sum all of the column sums together. Start a new sum, ...


4

The approach I would use typically for such a constellation is store the images in the file system use a database for the meta data (including references to the related image file names) The reason for this is that you will need indexing and transactional security for your meta data, but typically not for "parts" of your images (I guess they will be ...


4

Relevant XKCD: On the upside, you might be able to degenerate this task into hand-created bounding boxes for each seat. Take each seat and generate a "base line" from a photo that has no people in any seat under normal expected lighting conditions. Then when a picture to record attendance is taken - and assuming no smarty pants moves the camera or plays ...


4

In the specific case in the example they seem to be combining images of the different parts on the server and then sending a complete image to the browser. As can be seen if we take a look at the URL and start removing things so that we get access to the debug page: http://prodimage-725655301.us-east-1.elb.amazonaws.com/image-generator/debug-product-images/?...


3

Icons, like all other products of human creative effort, are automatically copyrighted to their authors. By default, you have no right to redistribute them. Whether or not you may reuse or or sell them with your program depends entirely on the license under which they are available. Being the standard icon for a particular platform has no bearing on that; ...


3

I've tried several gems, but now I'm using FineUploader together with PaperClip FineUploader handles a lot of the GUI for you, for example upload progress, drag-and-drop and multiple file uploads, and so on. I'm using PaperClip because I want to store the images on my servers instead of on S3. What we normally do is look for a stable out-of-the-box ...


3

After a little browsing, I created my own solution a few months back but failed to post it here in the interest of anybody that would like to do the same. Therefore, I will quickly describe the method before showing the code. It's in kotlin, but if you're familiar with Java and/or AS3 you should be able to understand the syntax. The Method Scan the entire ...


3

From a speed point of view, your Computer is most likely much faster than the server you have for your website/web-application, so it would make more sense to resize on the client, than on the server. I have a Java application where I change certain color pixels to another color, and then size the image down, and that total operation takes about 0.005 ...


3

If disc space is the only constraint then it doesn't matter which end resizes the image. The client might do it slightly slower than the server or the server may be overloaded with clients sending many images so its a judgement call for you to make based on expected usage patterns. However, there is one good reason for resizing on the client: network ...


3

A pop-up is probably suitable for an image embedded in an application: CC licenses have a flexible attribution requirement, so there is not necessarily one correct way to provide attribution. The proper method for giving credit will depend on the medium and means you are using, and may be implemented in any reasonable manner. (source) As for what ...


3

This is commonly called image registration (https://en.wikipedia.org/wiki/Image_registration). You might also look through OpenCV (https://docs.opencv.org/3.4.1/db/d61/group__reg.html) for an actual implementation. This used in processing MRIs to get rid of motion by the patient and I've heard it is used in mask alignment in chip manufacturing (finding and ...


2

Depending on the scale of your operation (not specified) and the platform you're targeting (not specified) your range of options is very wide. Assuming you're targeting a Unix/Linux platform, the default image processing library for #1 is ImageMagick - http://www.imagemagick.org/script/index.php It's been around for ever and is widely supported on a broad ...


2

Advantages Below 1/256th improvement in gradient display quality Disadvantages Not all browsers have implemented 48bpp PNG decoding Most displays can't render the full 8bit/channel gamut as well as they claim to, let alone 16 Increased file size You have to make a value judgement - is it warranted for a background element? Probably not.


2

If you are using these images on your website, store them exactly in all different sizes you are going to use on your website. Image Scaling is a very important factor in a website's performance, and saves bandwidth and page-load time. Scale images in accordance to your need, as disk space doesn't costs much. See what google has to say about image scaling ...


2

I think this varies from project to project. Generally the advise by Bart is a valid one. If these assets are directly connected to the source-code and managed by the developer (best example are images statically linked/embedded in a template) it's a good practice to have them inside the repo. If this isn't the case, we have to ask some other questions. ...


2

Your main question is, The thing I'm confused about, is how people usually associate many images with a single model. So I'll focus on that: In practice, Rails devs do this by using one of the gems for uploading and attaching images. E.g., Paperclip is maintained by Thoughtbot, is very well tested and supports S3. But if you're more interested in ...


2

It depends on the licensing for your theme. A lot of them are Creative Commons Attribution-NonCommercial-ShareAlike, but some are GPL, or even commercial. I highly doubt any of the licenses limit you to one operating system, but if you're redistributing your application to people outside your organization, you'll have to deal with the redistribution terms ...


2

Posting here because this is too long for a comment, but I'm not sure how good of an answer it is. I don't mean to be a Debbie Downer, but you haven't really done anything besides make the image gray-scale and increase contrast. Computer vision is a vastly complex topic -- you can't just write a simple Pythons script. You should start with the fundamentals ...


2

Using the id as the file name works fine for most applications. This assumes you are processing the image (resizing, cropping) and saving every image as the same file format. Otherwise you'll also want to store the file type in the table as well. That said, a couple of the possible drawbacks to be aware of: You'll have to overwrite existing files when ...


2

Storing the files should be the least painful option. However if you need the scalability you need to put it on a distributed file system such as GFS or HDFS. When you are storing them you can prescan them so they are valid image files get the sha256sum or 512 may be overkill for each and use that as the file name. (optionally) strip off non-image data ...


1

One of the simplest ways to compare color values is to divide a pixel into its color components, then treat those color components as elements defining a point in space, then compare the distance between the various points in space. You can use RGB, HSV, etc as your color components.


1

Having just tested it on a variety of images from a couple of web sites I maintain, I can state that I won't be using it because it seems to do nothing useful: it was unable to achieve any savings for any of the four images I gave it (two JPEGs and two PNGs). I had taken no special steps to optimize these images, just saving them in the most appropriate ...


Only top voted, non community-wiki answers of a minimum length are eligible