You do not need multiple images - you can do this with a single image - use any format supported on the target platform. Android supports PNG, GIF and JPG - I would choose PNG or JPG, with settings for JPG, since this is apparently a photograph.
Assuming that the existing image has a color (i.e. not black or white fur), you can change the colors of the fur either to
- coloring the image - it forces all the colors to the specified hue
- hue - this shifts the hue of all colors by a given amount
To implement this. you can use jjil - Jon imaging library - designed for mobile devices with specific Android support.
To implement both of the above transforms, follow these steps:
- first convert image to HSV using RgbHsv pipeline stage
- convert the desired color of the wool RGB to HSV (for example, red fur is required; convert rgb (red) to hsv (red). ( Code example ).
- Then you chose the way to change the color of the image - either by setting H (hue) for each pixel to the same hue value as the desired color of the fur (from step 2), or adding the difference of the selected hue to the hue of the image pixel (module 255) to get the change shade. You can also scale the V value to provide lighter or darker shades of fur.
- The HSV values ββof the image are then converted back to rgb. There is no HsvRgb filter in the jjil library, but this can be implemented as the inverse of RgbHsv. Here is the HSV2RGB function.
If other colors are important in the image, you can leave them unchanged and apply the conversion only to certain colors in the image. You check the current HSV value, and if the hue, S, or V values ββare outside of the ones you don't want to change, you just don't change these values. For example, if a cat has green eyes and brown fur, you skip the HSV values, where H indicates a shade of green - leaving this color, and the eyes remain unchanged.
source share