Giter VIP home page Giter VIP logo

miro's People

Contributors

3zcurdia avatar deradon avatar foxyblocks avatar grob321 avatar jonbuda avatar kevinjalbert avatar meltingice avatar mmyoji avatar pedrogimenez avatar pjkelly avatar vanne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

miro's Issues

deal with base64 image

I find when image src use base64,it can't work.
how do I add options to deal with base64 images?
Thank you .

Cocaine gem is deprecated

hi!

cocaine is deprecated and have been renamed Terrapin:
https://github.com/thoughtbot/cocaine

Upgrading to Terrapin is expected to be as simple as replacing the Cocaine constant with Terrapin.

Cocaine::CommandLine.new("echo", "hello") 

should become

Terrapin::CommandLine.new("echo", "hello") 

This is not a big issue, but this occurs a noisy log everytime we launch a server

Thank you !

Cocaine::ExitStatusError: Command '/usr/bin/convert'

Hi. I'm getting this error. Can you please help me?

sh: /usr/bin/convert: is a directory
Cocaine::ExitStatusError: Command '/usr/bin/convert ''/var/folders/ln/_nb7zgd52zsby0vqqs3h316r0000gn/T/source20140113-5346-14ic4j6.jpg'[0]' -resize '150x150' -colors '8' -colorspace 'RGB' -quantize 'RGB' '/var/folders/ln/_nb7zgd52zsby0vqqs3h316r0000gn/T/downsampled20140113-5346-dnq1fq.png'' returned 126. Expected 0
Here is the command output:


from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247/gems/cocaine-0.5.3/lib/cocaine/command_line.rb:91:in `run'
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247/gems/miro-0.2.3/lib/miro/dominant_colors.rb:49:in `downsample_colors_and_convert_to_png!'
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247/gems/miro-0.2.3/lib/miro/dominant_colors.rb:34:in `extract_colors_from_image'
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247/gems/miro-0.2.3/lib/miro/dominant_colors.rb:29:in `sorted_pixels'
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247/gems/miro-0.2.3/lib/miro/dominant_colors.rb:11:in `to_hex'
from (irb):8
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247@global/gems/railties-4.0.1/lib/rails/commands/console.rb:90:in `start'
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247@global/gems/railties-4.0.1/lib/rails/commands/console.rb:9:in `start'
from /Users/mariocarvalho/.rvm/gems/ruby-2.0.0-p247@global/gems/railties-4.0.1/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

Error extracting RGB values from TIF-File with ImageMagick 6.7.7-10 2015-01-19 Q16

I had to downgrade my ImageMagick version to the ImageMagick 6.7.7-10 2015-01-19 Q16. Since I downgraded it, the RGB extraction stopped working for me. I don't know if it is a bug. Are you able to help me with that?

The Miro object looks like this:

#<Miro::DominantColors:0x007f84fe872ca8 @image_type=nil, @src_image_path="public/images/swatches/313/original/swatch-313-ha02-25-001.tif"> and I am calling to_rgb on it.

Thank you in advance. I am using MacOS Yosemite.

This is the result:

convert: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `/var/folders/8x/5cpkltc94j79q9vyt76pw9pw0000gn/T/downsampled20150121-1483-8xgvxs.png' @ error/png.c/MagickPNGErrorHandler/1728.
Cocaine::ExitStatusError: Command '/usr/local/bin/convert ''.../images/swatches/313/original/swatch-313-ha02-25-001.tif'[0]' -resize '150x150' -colors '4' -colorspace 'RGB' -quantize 'RGB' '/var/folders/8x/5cpkltc94j79q9vyt76pw9pw0000gn/T/downsampled20150121-1483-8xgvxs.png'' returned 1. Expected 0
Here is the command output:

from /.rvm/gems/ruby-2.0.0-p195@global/gems/cocaine-0.5.4/lib/cocaine/command_line.rb:96:in `run'

UPDATE:

I implemented a hotfix here:
https://github.com/fbrix/miro/commit/6b4fc08990d60c937fffd542751bf10a283babaf

I think there is a problem with the PNG conversion with the older ImageMagick version.

New release?

It looks like there hasn't been a new official release of this gem since 2016; is the preferred method to reference github directly, or will a new release be cut soon? Came here in reference to the cocaine/terrapin deprecation.

Thanks in advance!

"Empty input file" error for image loaded from url

I have a loop that runs through a list of image-urls and opens the url with

Miro::DominantColors.new('http://www.example.com/image.jpg')

for some images it returns:

convert: Empty input file `/tmp/source20120709-6914-7hzuos.jpg' @ error/jpeg.c/EmitMessage/236.
convert: missing an image filename `/tmp/downsampled20120709-6914-1ldgk69.png' @ error/convert.c/ConvertImageCommand/3011.
/home/wolle/.rvm/gems/ruby-1.9.3-p194/gems/cocaine-0.2.1/lib/cocaine/command_line.rb:39:in `run': Command '/usr/bin/convert '/tmp/source20120709-6914-7hzuos.jpg' -resize '150x150' -colors '8' '/tmp/downsampled20120709-6914-1ldgk69.png'' returned 1. Expected 0 (Cocaine::ExitStatusError)
    from /home/wolle/.rvm/gems/ruby-1.9.3-p194/gems/miro-0.2.1/lib/miro/dominant_colors.rb:46:in `downsample_colors_and_convert_to_png!'
    from /home/wolle/.rvm/gems/ruby-1.9.3-p194/gems/miro-0.2.1/lib/miro/dominant_colors.rb:33:in `extract_colors_from_image'
    from /home/wolle/.rvm/gems/ruby-1.9.3-p194/gems/miro-0.2.1/lib/miro/dominant_colors.rb:28:in `sorted_pixels'
    from /home/wolle/.rvm/gems/ruby-1.9.m3-p194/gems/miro-0.2.1/lib/miro/dominant_colors.rb:10:in `to_hex'
    from color.rb:23:in `get_main_color'
    from color.rb:55:in `block in start'
    from color.rb:50:in `each'
    from color.rb:50:in `start'
    from color.rb:19:in `initialize'
    from color.rb:66:in `new'
    from color.rb:66:in `<main>

i tripple checked. all the image-urls are correct. what else could be the problem?

Animated GIF input problem

When using convert on animated gifs, it dumps them per frame, like tempfile-1.png, tempfile-2.png, etc, so miro can't get a color palette.

Suggesting skord/miro@85001e0 as a fix. Modifies the convert argument to use the first frame. If there's only one frame, as with most static images, it doesn't matter.

Histogram Performance

Hi!

First of all I really like the job that you made with this gem, but while I was reading the code I found that you do a lot unnecesary operations on the image processing like:
resize -> write -> load resized image -> group and arrange pixels -> delete temporaly files

I think a best approach it will be use directly the histogram from rmagick o even from mini_magick instead of use chunky_png which is slower than rmagick and at the end you will have something like this:

resize on memory -> fetch histogram

btw I am not just talking Im working on the solution too

Cheers

Transparency?

Is there any way to figure out if an image has a transparent background with this gem?

256

I need only get image and each pixel 0..255 (rgb to char)

Wrong number of arguments

After updating to 0.4.0 I get 'Wrong number of arguments (7 for 6)' on

path = "/var/www/app/public/images/avatars/my_image.jgp"
colors = Miro::DominantColors(path)
colors.to_hex # here I get the error

I'm running this from my Rails app using Ruby 2.2.5

What can cause this type or error?

Color detection fidelity

I tried with an image all blue (#0099cc) and the Miro found the blue color as dominant but with another hex code the #00509c.

There some setup to calibrate the color detection?

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Bundler now generates gems with a default 'MIT' license. There is even a License Finder
to help companies ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

If you need help choosing a license, github has created a license picker tool

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for gemspecs not specifying a license as a public service :)
So far it's going pretty well.
I've written a blog post about it

Add an extra option for colorspace

Hey man, your gem is great, I'm using it and I love, however it can be better. I'm extracting colors from an image in my site, but the colors returned differ a little bit from those of the image. I found out that it's due to the colorspace, I had to change it to sRGB, the problem es that your gem uses the same option (quantize) for quantize and colorpace. I suggest you adding an extra option for the colorspace. I had to do the following in my code:

def image_magick_params
    if Miro.histogram?
        "':in[0]' -resize :resolution -colors :colors -colorspace \"sRGB\" -quantize :quantize -alpha remove -format %c histogram:info:"
    else
        "':in[0]' -resize :resolution -colors :colors -colorspace \"sRGB\" -quantize :quantize :out"
    end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.