dither | A fast , correct image dithering library in Go | Computer Vision library
kandi X-RAY | dither Summary
kandi X-RAY | dither Summary
dither is a library for dithering images in Go. It has many dithering algorithms built-in, and allows you to specify your own. Correctness is a top priority, as well as performance. It is designed to work well on its own, but also implements interfaces from the standard library, so that it can be integrated easily in a wide variety of situtations. It supports images that make use of the alpha channel, AKA transparency.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dither
dither Key Features
dither Examples and Code Snippets
Community Discussions
Trending Discussions on dither
QUESTION
I have a batch of images that need a transparent background. I am able to create a black/white mask of the lighter and darker regions and want to use this mask to keep the pixels, which are white in the mask unchanged and set all pixel to transparent, which are black. The best outcome so far I got with
...ANSWER
Answered 2021-May-20 at 21:46You simply need to remove the "-mask" from your command line leaving your mask image (and add -alpha off). So the following works fine for me in ImageMagick 6.
Input:
QUESTION
I am trying to plot this checker pattern:
...ANSWER
Answered 2021-May-15 at 09:45Answer
Set the interpolate
argument to FALSE
(and furthermore, rescale
to FALSE
):
QUESTION
I'm trying to convert all image files within a folder to jpg using Pillow.
I'm new to pillow so I'm not 100% on my grasp of the concepts.
Here are the functions I'm using:
...ANSWER
Answered 2021-May-05 at 05:34You have a typo and a usage error. You'd need to change this:
QUESTION
I am creating a video effect that is supposed to look as in "Matrix" movie, but a bit different ("Matrix"-like video output will be mixed with an altered alpha channel with real video, so it will look half real, half with digits). I am using simply mplayer with caca driver (mplayer -vo caca video.mp4) together with screen recording and then mixing videos in other software. For this I needed to change "static uint32_t ascii_glyphs[]" array in file dither.c (from the code of the caca library as it published here: https://github.com/cacalabs/libcaca/blob/master/caca/dither.c) from: ' ', '.', ':', ';', 't', '%', 'S', 'X', '@', '8', '?'
to contain all Katakana symbols. But the problem is that it looks like they are not printable. So the terminal output of the video contains only shadow blocks. I should say that the bash code:
ANSWER
Answered 2021-Apr-26 at 10:12The problem is that hiragana and katakana are fullwidth characters. When Caca tries to write a character to the screen using caca_put_char()
, it checks if there is already a fullwidth character on the screen, and if so, it will replace part of it with a space. Since all possible character positions on the screen are written to, it ends up overwriting any fullwidth character with a space, and thus in the end no katakana will be visible.
I think you would have to modify Caca to handle fullwidth characters in the dither character set. If all characters are fullwidth, it should just write only to even columns on the screen. If you have a mix, it will be more complex, but you could for example make it so that if there is already a fullwidth character on a given position, it will just not try to overwrite it.
QUESTION
I've gotten some code thrown together that will go through a folder, open all images with a certain ending, and create a histogram of them with ImageMagick. What I can't do (and maybe this is a conceptualization issue as I'm still fairly new to this), is figure out how to record that into a spreadsheet, ideally with the filename attached. PyXl seems to work with Pandas and Numpy, but I can't figure out the path to take this output and record it.
Is there a solution to take the histogram output and record it in a spreadsheet?
Edit: Adding my code thus far. Operating in Windows 10 Pro, using VSCode.
...ANSWER
Answered 2021-Apr-21 at 11:19On reflection, I think I would probably do it with PIL, wand or OpenCV rather than parse the output of ImageMagick which is a bit ugly and error-prone. I have not worked out a full answer but these ideas might get you started:
Rather than use a lossy JPEG for your palette of colours, I would suggest you use a loss-less PNG or GIF format. You can make the (tiny) palette file for remapping with a command like:
QUESTION
Problem
In my quite short script I have the problem that it sometimes reports that the filename or extension is too long. Depending on the $image
and $size
values in my script this error may occur or not.
E.g. the script below produces this error with the image from here - saved and converted to "example3.png".
I do use Version: ImageMagick 7.0.10-62 Q16 x64 on windows and I don't know what to do with the error message... Any ideas what the problem is here?
Powershell script
...ANSWER
Answered 2021-Apr-15 at 12:51I am not sure what's going on with powershell
but if the issue is the length of the command-line, you can supply the sparse colour from a file like this:
QUESTION
Recently, our teacher gave us the task to convert a colorful image to a 1-bit image using Java. After a little experimentation I had the following result:
...ANSWER
Answered 2021-Jan-29 at 16:32BufferedImage image = ...
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
Color color = new Color(image.getRGB(x, y));
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
int mono = (red+green+blue)/255;
//Adding to image buffer
int col = (0 << 24) | (mono << 16) | (mono << 8) | mono;
image.setRGB(x,y,col);
}
}
QUESTION
I am trying to implement Floyd Steinberg Dithering in MATLAB, using the pseudocode on the Wikipedia page https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering
My code is below
...ANSWER
Answered 2020-Oct-18 at 14:42The problem is that you tried to improve the pseudocode and remove oldpixel
! Note that the algorithm does not calculate an error between the quantized pixel and its corresponding value in the original image, but rather the error between the quantized pixel and the previous value in the dithered image, which may have been updated while scanning the previous pixels.
Bring oldpixel
back and review the whole algorithm one more time.
But even after the modifications, you can not expect the results to match the MATLAB output, which could be the result of differences in the details of the two implementations.
QUESTION
I have created a batch job which opens .TIFF-files in a folder, resizes them, converts them to a .PNG-file and then saves them in a different folder. The batch job runs fine and the pictures get processed correctly, but at some specific picture (which I can open as a normal .TIFF-file), the process stops with the following error log:
...ANSWER
Answered 2020-Nov-12 at 09:28I am not altogether sure what's going on here. I think, but am by no means sure, the problem is that the file has 4 samples per pixel (i.e. RGBA) but the "Sample Format" tag only gives the type (i.e. unsigned integer) for 3 of the 4 samples and that is upsetting the library.
Here is tiffdump
output with the contradictory fields highlighted:
QUESTION
How can I convert a greyscale image to 1-bit black/white with definable threshold, but maintaining existing transparency/alpha?
Existing questions miss out the transparency part of my question.
Also, I need to do this on the command-line in macOS. ImageMagick's convert
is one option, but not the only option.
Required behaviour:
- pixels below a definable threshold are coloured black
- pixels above a definable threshold are coloured white
- transparent pixels remain untouched
I prepared this "goal" image manually:
What I have tried:
$ convert -threshold 50% in.png out.png
- everything over threshold becomes white
- everything below the threshold becomes transparent!
$ convert -white-threshold 50% in.png out.png
- everything over threshold becomes white
- everything below the threshold becomes transparent!
$ convert -black-threshold 50% in.png out.png
- everything over a different threshold becomes white
- nothing becomes black!
$ convert +dither -monochrome in.png out.png
- dithering disabled
- 1-bit conversion locked to 50% but performs as expected
- but: transparent pixels are turned black!
$ convert -depth 1 -colors 3 -alpha set in.png out.png
- almost there
- but: threshold not definable!
Any thoughts appreciated!
Image Ref: http://www.studentshow.com/gallery/6097929/Pyramid-Module-Value-Grayscale
...ANSWER
Answered 2020-Oct-10 at 22:58Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dither
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page