lundi 23 novembre 2015

Carrierwave image magick convert png as white transparent for android notification icon

I am using carrierwave(Image Magick) to convert a image as white transparent for Android notification icon.

http://ift.tt/wSGUQI

This my image uploader

class IconUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  DIMENSIONS = [48,48]

  process :white_transparent

  def white_transparent
    manipulate! do |img|
      img.combine_options do |cmd|
        cmd.transparent("#ffffff")
        cmd.background "rgba(255,255,255,0.0)"
        cmd.channel "a"
        cmd.separate
        cmd.negate
      end
      img = yield(img) if block_given?
      img
    end
  end

  def filename
    "notification_icon.png"
  end
end

But I am getting the image as 'black on white' instead of "white on black".

This how i want the image enter image description here

Am i missing anything here? Kindly help.

Aucun commentaire:

Enregistrer un commentaire