1

I can not find any command to create solid color with rgb options in Java.

I can create it in commandLine like

convert -size 100x200 xc:rgb(0,255,255) whatever.jpg 

from here

But how do that in Java?

Something like this:

        ConvertCmd cmd = new ConvertCmd();
        IMOperation oper = new IMOperation();

        LinkedList<String> list = new LinkedList();
        list.add("xc:(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue() + ")");
        list.add("-size " + width + "x" + height);
        list.add(fillepath);
        oper.addRawArgs(list);

        cmd.run(oper);

looks not so pretty

Dred
  • 1,076
  • 8
  • 24
  • Is this a question about im4java? http://im4java.sourceforge.net/ – NeplatnyUdaj Jan 28 '19 at 14:45
  • yes, about that library – Dred Jan 28 '19 at 15:07
  • If you cannot find any equivalent to xc: or canvas:, then you can read in some image and then colorize it. If the image is too large, then crop it before or after colorizing. Sorry I do not know any of the Java APIs for Imagemagick – fmw42 Jan 28 '19 at 18:14
  • It's a web,I should make image depends on parameters which user send to server. I can't make unknown color from uknown image – Dred Jan 28 '19 at 18:29
  • With the colorize tool, you provide some color and it makes the image that color everywhere. So it does not matter what image you start with. Just crop any image to the size you want and colorize it with the color you want. This would be one solution if you cannot find the equivalent of xc: or canvas: in your Java API. – fmw42 Jan 28 '19 at 19:48

0 Answers0