Questions tagged [image]

This tag is for questions related to the loading, formatting, saving, compression, and display of data representing pictures.

Filter by
Sorted by
Tagged with
98
votes
9answers
37k views

Fastest way to clamp an integer to the range 0-255

I'm working on some image processing code that can generate pixel values outside of the normal range of 0 to 255, and I'd like to clamp them back into the valid range. I know that there are saturating ...
35
votes
7answers
4k views

Increase performance creating Mandelbrot set in python

I created a program in python that generates an image of the mandelbrot set. The only problem I have is that the program is quite slow, it takes about a quarter of an hour to generate the following ...
19
votes
6answers
52k views

Determining if 2 images are the same

This is my program code for comparing if 2 images are the same. It basically uses the open dialog and opens 1 image at a time and puts it in 1 picture box. I heard that ...
18
votes
2answers
3k views

Julia Fractal Drawing in C++

I'd like a code review for this program written to draw Julia fractals. I'm specifically looking for feedback on: Style: I haven't written much C++ before, so I'm interested in knowing better or more ...
18
votes
5answers
478 views

“Heat spot” image generation

I wrote a function that generates an image like: The function is as follows: ...
16
votes
4answers
9k views

Processing an image to extract green-screen mask

I am using OpenCV to process an image, and in my code, I have to check / edit each pixel separately: ...
16
votes
2answers
1k views

Python Manga Image Viewer

I'm currently making a manga (read: comic) viewer in Python. This project has been a code-as-you-learn project, because I have been trying to code this as I learned about Tkinter. Python I have known ...
15
votes
6answers
14k views

Determine if an image is opaque or transparent

I wrote an extension method defined for the Image Class (System.Drawing) — which returns a Boolean value telling you if the image is opaque or transparent. The color of each pixel in the image is ...
15
votes
3answers
8k views

Change desktop background

I've created a simple program that downloads an image (different image every day), then sets it as my desktop background. It is a console application, and closes immediately after downloading the ...
15
votes
3answers
2k views

Refactoring image loading/manipulation class

I have this Image class that I've been using for some time now on personal projects and games I eventually write. It was written in C++98 style and it is starting ...
15
votes
1answer
11k views

Rotating greyscale images

For educational purposes I wrote a little piece of code to rotate greyscale images as "low level" as possible, that is, not using any rotate() function, but doing ...
14
votes
5answers
1k views

Mandelbrot image generator

I have written a C program to generate a PPM (Portable Pixmap) image of the Mandelbrot set. The program implements many things in C I am fairly unfamiliar with (Structures, error handling, use of new ...
14
votes
1answer
1k views

Dynamic Colour Binning: Grouping Similar Colours in Images

This is a piece of code that implements an image-processing algorithm I came up with. I call it Dynamic Colour Binning. It's a fairly academic exercise that was more about providing a learning ...
13
votes
4answers
47k views

Resizing image but keeping aspect ratio

I wrote some code that resizes an image to fit in a given box. I think that some parts of the code are not needed (for example if it's a box image). Is there a more efficient way to do this? Is there ...
13
votes
6answers
4k views

Getting the dominant RGB color of a bitmap

I'm currently running this function 60 times per second in order to get the dominant color on my screen in RGB values. It is using approximately 15% of my CPU on 30FPS and 25% of my CPU on 60FPS. Is ...
13
votes
1answer
1k views

OpenCL implementations of IQZZ and IDCT for MJPEG

I am using this code for MJPEG decoding and I am trying to make two functions (IQZZ and IDCT) run faster on the GPU (NVIDIA Tesla k20c). I am using the OpenCL framework to accomplish this task. I ...
13
votes
2answers
12k views

Read and write BMP file in C

I'm teaching myself a little C, and I've found this website. It has an exercise about manipulating a BMP file in C. I would like to know if I can make my code look more "idiomatic" or professional, ...
13
votes
1answer
315 views

How many days to Go?

Here's my first serious attempt at writing Go code. This program counts the number of days until a certain date and displays that in the system tray. To do that, it first reads the target date from ...
12
votes
5answers
8k views

Image resizing class

How does this class to resize an image look? ...
12
votes
3answers
930 views

Image Filter client

I've made an image filtering client for JavaScript that runs on jQuery, Vex and Fabric.JS. You simply include the required files in your html page, along with something like: ...
12
votes
3answers
16k views

Bitmap implementation

I recently started cleaning up my projects and decided that I want to create a personal repository of useful bits of code. I found this bitmap code between them and heavily edited it and I'd ...
12
votes
1answer
2k views

Steganography for images

For a school project I'm working on a small library to do steganography. I've just finished the first method of steganography and thought I'd get some feedback. This steganography method works by ...
12
votes
1answer
5k views

Assigning width and height to specify image dimension using jQuery

After testing my site against GTMetrix, I get warnings on not specifying image dimensions. I am working on a WordPress site. Here is my solution: My first solution was: ...
12
votes
1answer
194 views

Replace color in image measured by Euclidean distance

This script replaces the red hair in image to black color (replace one color to another) Three major parts in this script Not just replace color red to black, I hope the output image looks natural, ...
11
votes
4answers
7k views

Python 3 function to rotate an image 90°

A coding challenge that rotates an image 90 degrees counterclockwise. The image is represented as an array matrix. I believe the time complexity is O(n2), but I'd like to know for sure, as well as any ...
11
votes
2answers
2k views

K-Means image segmentation algorithm

I am a new C++ programmer and I have some experience in Python and C but I was almost completely self taught (I learned C++ with OpenClassrooms). I would like to learn the conventions and how things ...
11
votes
1answer
57 views

Visualization of the Pythagorean theorem

Background The Pythagorean theorem asserts that for a right triangle with hypotenuse \$c\$ and other sides \$a\$ and \$b\$, the area of the square placed upon \$c\$ is equal to the sum of the areas ...
11
votes
2answers
4k views

Making GIFs with Java

I wrote a Java class to make a GIF animation from a list of images. The whole project can be found here. I am pretty new with GitHub, so I would be very glad if you can give critiques regarding my ...
11
votes
1answer
235 views

Using Support Vector Machine algorithm to analyze satellite image [closed]

I am using Support Vector Machine (SVM) algorithm to perform a classification. The satellite image I am using is really big (5GB) that's why I am trying to take advantage of ...
10
votes
4answers
6k views

Imaging with getPixel() and loops

I wrote perfectly working code that reads an image, and then does a kind of threshold on it by zone. If the zone has too much white then it turns all the zone into white, otherwise it turns into black....
10
votes
3answers
4k views

Writing .ppm images to a file

I am struggling with commenting and variable naming. My teacher says my comments need to be more explanatory and explicit. He says my variable names are also sometimes confusing. I was just wondering ...
10
votes
2answers
1k views

Image handling class

Let me start by saying that I am very happy with this code. I want to share it with other people because I think they will find it helpful, but I want to make sure I did everything in good form ...
10
votes
3answers
1k views

PPM/PGM Image processing library in Haskell

I've written a small library for reading and writing PGM/PPM images. The format is described here. I attach the library itself and a small utility to convert binary encoded images to ASCII encoding. ...
10
votes
2answers
4k views

Writing a bitmap image from C++

Here's my function that creates a bitmap file from an array of pixels. It can write a bitmap both with transparency and without transparency. Please review my code and give constructive criticism on ...
10
votes
1answer
100 views

Slow image generation

I build a Tower of Hanoi solver which print the solution as an image It works as expected but generating the image is relatively slow compared to the time to calculate the answer. Here is the code: ...
10
votes
2answers
932 views

Mandelbrot Fractal Drawer in C++

As an exercise to learn how OpenGL and image creation worked, as well as to satisfy a curiosity I've developed for Chaos Theory, I decided to create a mandelbrot fractal drawer in C++, which can ...
10
votes
3answers
225 views

Detect optimized

I've been trying to optimize this piece of code: ...
10
votes
1answer
3k views

Fast way to find the most similar color in an array

I have an image and a palette that I want to apply on that image, that is, change all colors of the image to match the closest they can find on the palette. While I have multiple ways to do it, I want ...
10
votes
2answers
571 views

Recolour a shape

I am starting with a starting colour, a target colour and a starting position in an image. I want to change every contiguous pixel if it is close to the starting colour. Imagine a stop sign. It has ...
10
votes
1answer
885 views

Image template matching algorithm from scratch

I wanted to write a template matching algorithm from scratch. The key area's I'm interesting in are readability, maintainability, DRY, and if the program performance/efficiency could be improved in ...
10
votes
1answer
1k views

Blurring an Image

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
10
votes
1answer
132 views

Unique-ifying an image

I'm writing a program that takes an input image, and generates a set of unique colors, and repaints the image using only those colors. It takes a long time, and I'm hoping to improve the running time. ...
10
votes
1answer
1k views

Fast bicubic upscaling in C# for image scaling

I've been trying to write an image scaler in C# with a focus on improved performance over the GDI+ scaler. My current bicubic implementation when running with a single thread is slightly slower than ...
10
votes
1answer
520 views

Converting ASCII to an image

So after I finished my fractal generator, I decided that text is ugly, at least compared to pictures, so I made a text-to-picture converter: ...
10
votes
0answers
162 views

Multithreaded Groovy Mandelbrot

Seeing as it's October, I thought I'd do the community challenge. Due to my inexperience coding in Groovy, I decided to give Groovy a go. I'm not sure how well I followed Groovy conventions, and the ...
9
votes
2answers
19k views

Storing data in the pixels of an image

I've recently redone something I wrote around a year ago since I'd done it wrong (it required the original image to decode an imagine, which can be avoided), so I'm wondering if I could either get ...
9
votes
2answers
176 views

Get icon from website, show and update icon

I was thinking the other day how could I get the icon from a website and make it show and update when it is updated on the site so I made this code: ...
9
votes
2answers
744 views

Reading binary files in XTF format

I have a few thousand binary files that have corresponding structs in them, followed by any number of bytes (this exact number of bytes is given in one of the fields in the structs). I read in data ...
9
votes
1answer
455 views

Bitmap problem performance boost

Problem statement: Input is a rectangular bitmap like this: 0001 0011 0110 The task is to find for each black (0) "pixel", the distance to the ...
9
votes
2answers
3k views

Pure JS Image Slider

I was just wanting a code review on this image slider I made. I don't have anyone else to give me their opinion on the code I write outside of work. Is this sloppy? Is it wrong? Is it ineffective? ...