dither | A fast , correct image dithering library in Go | Computer Vision library

 by   makeworld-the-better-one Go Version: v2.3.0 License: MPL-2.0

kandi X-RAY | dither Summary

kandi X-RAY | dither Summary

dither is a Go library typically used in Artificial Intelligence, Computer Vision applications. dither has no bugs, it has no vulnerabilities, it has a Weak Copyleft License and it has low support. You can download it from GitHub.

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

            kandi-support Support

              dither has a low active ecosystem.
              It has 265 star(s) with 9 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 6 open issues and 5 have been closed. On average issues are closed in 124 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of dither is v2.3.0

            kandi-Quality Quality

              dither has no bugs reported.

            kandi-Security Security

              dither has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              dither is licensed under the MPL-2.0 License. This license is Weak Copyleft.
              Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.

            kandi-Reuse Reuse

              dither releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dither
            Get all kandi verified functions for this library.

            dither Key Features

            No Key Features are available at this moment for dither.

            dither Examples and Code Snippets

            No Code Snippets are available at this moment for dither.

            Community Discussions

            QUESTION

            Make transparent regions using a mask
            Asked 2021-May-20 at 21:46

            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:46

            You 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:

            Source https://stackoverflow.com/questions/67616204

            QUESTION

            How to turn off smoothing/blurring when plotting a matrix as an cimg object
            Asked 2021-May-15 at 10:52

            I am trying to plot this checker pattern:

            ...

            ANSWER

            Answered 2021-May-15 at 09:45

            Answer

            Set the interpolate argument to FALSE (and furthermore, rescale to FALSE):

            Source https://stackoverflow.com/questions/67545230

            QUESTION

            Pillow: Cannot Convert 'P' to 'RGB'
            Asked 2021-May-05 at 05:34

            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:34

            You have a typo and a usage error. You'd need to change this:

            Source https://stackoverflow.com/questions/67393593

            QUESTION

            libcaca - changing ascii glyphs to Katakana
            Asked 2021-Apr-26 at 10:12

            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:12

            The 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.

            Source https://stackoverflow.com/questions/67237293

            QUESTION

            Recording ImageMagick histogram data into Excel/Google Sheets
            Asked 2021-Apr-21 at 21:25

            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:19

            On 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:

            Source https://stackoverflow.com/questions/67191498

            QUESTION

            ImageMagick script fails with MISLEADING filename or extension too long (-sparse-color)
            Asked 2021-Apr-15 at 12:51

            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:51

            I 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:

            Source https://stackoverflow.com/questions/67106140

            QUESTION

            How to implement 1-Bit Dithering using Java?
            Asked 2021-Jan-29 at 22:35

            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:32
            BufferedImage 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);
              }
            }
            

            Source https://stackoverflow.com/questions/65953579

            QUESTION

            Floyd Steinberg Dithering Matlab - What am I doing wrong?
            Asked 2020-Nov-14 at 15:46

            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:42

            The 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.

            Source https://stackoverflow.com/questions/64412335

            QUESTION

            "OSError: 2" When converting TIFF image to PNG with Python Image Library
            Asked 2020-Nov-12 at 09:28

            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:28

            I 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:

            Source https://stackoverflow.com/questions/64746802

            QUESTION

            Convert a greyscale image to 1-bit black/white with definable threshold, maintaining transparency?
            Asked 2020-Oct-10 at 22:58

            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.

            Sample image:

            Required behaviour:

            1. pixels below a definable threshold are coloured black
            2. pixels above a definable threshold are coloured white
            3. transparent pixels remain untouched

            I prepared this "goal" image manually:

            What I have tried:

            1. $ convert -threshold 50% in.png out.png

              • everything over threshold becomes white
              • everything below the threshold becomes transparent!
            2. $ convert -white-threshold 50% in.png out.png

              • everything over threshold becomes white
              • everything below the threshold becomes transparent!
            3. $ convert -black-threshold 50% in.png out.png

              • everything over a different threshold becomes white
              • nothing becomes black!
            4. $ 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!
            5. $ 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:58

            This works for me on IM 6.9.11.34 Q16 Mac OSX Sierra.

            Source https://stackoverflow.com/questions/64297092

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install dither

            In your project, run. You can import it as "github.com/makeworld-the-better-one/dither/v2" and use it as dither.

            Support

            More methods of dithering are being worked on, such as Riemersma, Yuliluoma, and blue noise.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/makeworld-the-better-one/dither.git

          • CLI

            gh repo clone makeworld-the-better-one/dither

          • sshUrl

            git@github.com:makeworld-the-better-one/dither.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Computer Vision Libraries

            opencv

            by opencv

            tesseract

            by tesseract-ocr

            face_recognition

            by ageitgey

            tesseract.js

            by naptha

            Detectron

            by facebookresearch

            Try Top Libraries by makeworld-the-better-one

            amfora

            by makeworld-the-better-oneGo

            didder

            by makeworld-the-better-oneGo

            md2gemini

            by makeworld-the-better-onePython

            go-gemini

            by makeworld-the-better-oneGo

            gemget

            by makeworld-the-better-oneGo