tinypng | Simple API client for TinyPNG.org | Compression library

 by   benmanns Ruby Version: Current License: MIT

kandi X-RAY | tinypng Summary

kandi X-RAY | tinypng Summary

tinypng is a Ruby library typically used in Utilities, Compression applications. tinypng has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

TinyPNG is a simple API client for TinyPNG.org, which compresses your PNG images by 50-70% while preserving full transparency. This gem was initially created by reverse engineering the TinyPNG website. Since then, TinyPNG has begun developing an Official API which is in alpha stages. In the future, an API key will be required to use the TinyPNG API and gem.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              tinypng has a low active ecosystem.
              It has 71 star(s) with 13 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 1455 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of tinypng is current.

            kandi-Quality Quality

              tinypng has 0 bugs and 0 code smells.

            kandi-Security Security

              tinypng has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              tinypng code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              tinypng is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              tinypng releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              tinypng saves you 22 person hours of effort in developing the same functionality from scratch.
              It has 61 lines of code, 6 functions and 5 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed tinypng and discovered the below as its top functions. This is intended to give you an instant insight into tinypng implemented functionality, and help decide if they suit your requirements.
            • Shows an image .
            • Create a new image
            • Get input parameter
            Get all kandi verified functions for this library.

            tinypng Key Features

            No Key Features are available at this moment for tinypng.

            tinypng Examples and Code Snippets

            No Code Snippets are available at this moment for tinypng.

            Community Discussions

            QUESTION

            how can i make an image file downloadable from apache server using php?
            Asked 2019-Nov-25 at 13:34

            I don't know if this has been asked before, please pardon in advance.

            I created an image compression web app using the tinyPNG API, and it works as intended - that is users can upload an image file and it is compressed and saved in the server.

            But then I create a download functionality for the user to download/save the compressed image.

            On clicking the download link it throws up an error:

            can’t find the file at http://localhost/var/www/html/imgtest/uploads/67403938_10219921906785196_7063388762713096192_n_1574687362.jpg.

            Even though the compressed image is in the server.

            Please help!!!

            MY CODE:

            ...

            ANSWER

            Answered 2019-Nov-25 at 13:34

            The problem in your code is, that you create the link with $compress_file that contains absolute path to the file.

            /var/www/html/imgtest/uploads/67403938_10219921906785196_7063388762713096192_n_1574687362.jpg

            So when the link is clickend and the url is resolved in browser the result is

            http://localhost/var/www/html/imgtest/uploads/67403938_10219921906785196_7063388762713096192_n_1574687362.jpg.

            So if the localhost domain is pointed to /var/www/html/imgtest/ than the server is looking for the file in this path which doesn't exist:

            /var/www/html/imgtest/var/www/html/imgtest/uploads/...

            When you are generating the path to the compressed file you should put it's url into other variable where you wouldn't prepend the current directory.

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

            QUESTION

            How do you modify this script to run TinyPNG on opened files instead of having to use the open dialog to select a file?
            Asked 2019-May-09 at 07:32

            I'm trying to modify this script to compress and then close all the opened files with the TinyPNG Photoshop plugin as opposed to having to choose one file at a time in an open dialog box. They do offer another script that allows you to compress a whole folder. However, I find myself needing to compress 10 out 50 images in a folder so I'd rather just be able to select those 10 or to open those 10 and run the script on all open files.

            I've tried replacing

            compressFile(File.openDialog("Choose a PNG or JPEG file to compress")

            with

            compressFile(app.activeDocument)

            in an attempt to have the script just compress the current document.

            Instead of using the active document it simply skips to the catch(error).

            ...

            ANSWER

            Answered 2019-May-09 at 07:32

            compressFile() requires a File object while activeDocument is a document object.

            For opened documents you'll want a loop through the documents:

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

            QUESTION

            How to compress images via webpack 4
            Asked 2019-Mar-12 at 12:16

            I need compress images like a TinyPNG and save compressed images in dist folder. I use webpack 4 and found imagemin-webpack.But I don't understand what use: plugin or loader? Please, help to do configuration for this task.

            ...

            ANSWER

            Answered 2019-Mar-12 at 12:16

            For compressing images in Webpack 4 I am using "img-loader".

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

            QUESTION

            Shell commando not working for compression photo's by TinyPNG
            Asked 2018-Dec-07 at 20:16

            Hello guys I don't real know much about shells. I need to compress some PNG files and I found a bash shell script on the web. The bash shell normally works with the API of tinyPNG

            When I run the shell I get this error:

            bash: tinypng.sh: command not found...

            I tried to run it by this method:

            ...

            ANSWER

            Answered 2018-Dec-07 at 20:16

            tinypng --help shows your solution:

            tinypng -d tiny_pngs/ -- foo.jpg bar.png baz.png

            which will shrink foo.jpg, bar.png, baz.png and download the shrinked files to tiny_pngs/ directory.

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

            QUESTION

            Alternative method instead of using for f in "$@" bash shell command?
            Asked 2018-Sep-25 at 15:18

            I have the following script that I got from tinypng.com and Instead of using the for f in "$@" command i would like it to just run inside the specified folder on desktop called FOLDER. Thanks!

            ...

            ANSWER

            Answered 2018-Sep-25 at 15:18

            Assuming you are simply trying to iterate over files in a folder, than for f in ~/Desktop/FOLDER/* should work.

            Or alternatively for f in $(find ~/Desktop/FOLDER -maxdepth 1 -type f) This one also removes any subfolders from the list so you may get rid of if [ -f $file ] (but it also lists hidden files, not sure if that's OK for your case or not)

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

            QUESTION

            How to convert data URI to buffer (string with binary)?
            Asked 2018-Apr-03 at 13:30

            I am using react to edit an image and send its final data using mycanvas.toDataURL() to php.

            The API I am using says, instead of an image, I could although

            [...] upload an image from a buffer (a string with binary)

            Their example looks like this:

            ...

            ANSWER

            Answered 2018-Apr-03 at 13:30

            You can try converting the string to an image file and then send that file, you can use a code like this to do that:

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

            QUESTION

            Is file_get_contents in PHP the same as toDataUrl in Javascript?
            Asked 2018-Apr-03 at 11:13

            I want to use an API to compress images. It says the input can as well be a buffer (string with binary), for example:

            ...

            ANSWER

            Answered 2018-Apr-03 at 11:13

            file_get_contents returns the content of a file as string, and that string exactly represents the content of the file.

            .toDataURL() gives you a data url. The data:image/png;base64, part tells that the following data represents a png and that the data is base64 encoded.

            To get the same data representation as you get with file_get_content you would need to decode the iVBORw0KGgoAAAANSUh...

            So yes, both give you the content of a file, but they don't do that in the same way.

            To toBlob on the other hand will return a Buffer containing the data in the same representation as file_get_contents would do.

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

            QUESTION

            Am Using tinify in node js. Wow can we download supressed file using nodejs?
            Asked 2018-Mar-20 at 20:16

            I am using npm install --save tinify then uploading my image files using nodejs but I need compressed .zip file in my system .

            When I'm uploading my image files through browser at https://tinypng.com after uploading it shows download option that is perfect. But how can we do same through nodejs?

            Here is my code:

            ...

            ANSWER

            Answered 2017-Apr-28 at 08:01

            You can use tinify's method that converts and writes the compressed image at once:

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

            QUESTION

            H1 tag does not show up
            Asked 2018-Mar-09 at 11:28

            I'm struggling to understand why my H1 does not show up. It is covered by a div. The weird part is that the H1's parent div is visible if I change background color to something else than transparent. Input tag inside the same div is always visible as well. Only H1 is problematic.

            Here is the link to the code: H1 does not show up And code HTML:

            ...

            ANSWER

            Answered 2018-Mar-09 at 02:11

            The issue is the transform: scale on .imageslider, the content is exceeding the width of its parent. Then also having overflow: hidden; is trimming anything outside the element.

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

            QUESTION

            Can you optimise the Responsive Images Wordpress creates?
            Asked 2017-Oct-27 at 10:52

            I'm analyzing my site using Google PageSpeed Insights. It says "Properly formatting and compressing images can save many bytes of data." I've definitely done that as I'm uploading images that have been through https://tinypng.com/.

            I think it's WordPress causing the issue by generating various responsive images as the warning is related to a filename -1024x525.png which isn't the name of the file I uploaded.

            Is this the automatically generated WordPress responsive images? If so, is there a way to optimize them? Google seems to think I can save ~30% which would be awesome.

            ...

            ANSWER

            Answered 2017-Oct-27 at 10:52

            Use this plugin also which can you use in your site https://wordpress.org/plugins/w3-total-cache/

            Here is optional things which you can use it.. https://wordpress.org/plugins/imagify

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install tinypng

            Add this line to your application's Gemfile:.

            Support

            Fork itCreate your feature branch (git checkout -b my-new-feature)Commit your changes (git commit -am 'Add some feature')Push to the branch (git push origin my-new-feature)Create new Pull Request
            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/benmanns/tinypng.git

          • CLI

            gh repo clone benmanns/tinypng

          • sshUrl

            git@github.com:benmanns/tinypng.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

            Explore Related Topics

            Consider Popular Compression Libraries

            zstd

            by facebook

            Luban

            by Curzibn

            brotli

            by google

            upx

            by upx

            jszip

            by Stuk

            Try Top Libraries by benmanns

            goworker

            by benmannsGo

            onhub

            by benmannsGo

            cleverbot

            by benmannsRuby

            goworker-examples

            by benmannsGo

            digger

            by benmannsRuby