Jump to content
You must now use your email address to sign in [click for more info] ×

Is possible combine three black white images way one is L and others are A,B. and similar to CMYK.


Recommended Posts

Is possible combine three black white images way one is L and others are A,B. and similar with CMYK. RGB i know idea what i can use i use images as colour images (what have data only chanel R or G or B) but 
and layer them suitable mixing mode (i dont remember exact mode name) same idea does not work with these others. and if i use in gradient map with cmyk values for points i wonder if inbeetween values stay cmyk values. if stay i maybe found solution how can do this with cmyk and i this is related creative art maybe others know other reasons use it. nicely i allready found way paint only L chanel for example.(allows correct looking highlights).

Link to comment
Share on other sites

oddly i found in rgb mode gradient map if i use rgb project with cmyk cyan converts it to rgb cyan i mean pure one what is 8bit values is 0,255,255. not nice
and others as well i can do thing of course when i convert project to cmyk and load images to it they stay rgb and i can then map them such gradient maps what i mean put them top of each other. basically solved but if have single image and convert it cmyk profile before gradient map gets some its colours lost.

Link to comment
Share on other sites

5 hours ago, MxHeppa said:

Is possible combine three black white images way one is L and others are A,B.

Yes. One way is to use the Channels panel to transfer the lightness of each monochrome image to the respective L, A and B channels of a new Pixel object.

  1. Place the three monochrome images into a LAB document and use Rasterise command to convert them to Pixel objects.
  2. Name the Pixel objects "L", "A" and "B" (without the double quotes).
  3. Run the attached macro which will generate a composite Pixel object named "LAB".

L, A & B to LAB.afmacro

Edited by ,,,
typo
Link to comment
Share on other sites

document seems be needed be format what this end result needed be. but huge and giant thanks these macros. and i also try also understand how they work.
and saddly making such with HSL values is impossible now i bet. i maybe get oeher tool someday such HSL use i know program what allows such. also have other nice things what are hard or impossible with these Affinity apps. and i mean when we talk creative usage. but basic image processing needs is terrible to my taste and if need photoshop style painting tools also then.(and photoshop style is less what real natural media painting programs are but still nice often). terrible means slow at least and i feel maybe also overly complex interface. is also cheap app.

ps. now i try found cmyk colour profile what is widest possible. and try remember do folder for this kind macros for this app ones what i cannot import to see panel where are these huge collections what other people done.

Link to comment
Share on other sites

33 minutes ago, MxHeppa said:

nd saddly making such with HSL values is impossible now i bet

A long time ago I made procedural texture filters to convert from RGB to HSL and vice versa.

 

So in case you have 3 greyscale layers for HSL, you can convert them to RGB and combine.

The filters are live / non-destructive - bit quite demanding for your PC.

 

 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

As APhoto macros are kinds of black boxes, here's an .aphoto file with a history starting from a grayscale image that has L, a and b as distinct layers, showing a procedure of converting the image to Lab using spare channels. I think this was pretty much what the macro above did (though it might have been built on a bit different starting point).

Grayscale2LAB.afphoto

Link to comment
Share on other sites

On 1/31/2023 at 11:35 PM, NotMyFault said:

A long time ago I made procedural texture filters to convert from RGB to HSL and vice versa.

Thanks! The HSL to RGB filter works nicely, but I cannot get the RGB to HSL work properly to use it for HSL separation (and subsequent saving to grayscale channels), so I have used the following modified Python script (picked from codedrom.com) to first create HSL values separated and combined into R, G and B channels.

import colorsys
from PIL import Image
import numpy


def main():

    print("-------------------------")
    print("| codedrome.com         |")
    print("| RGB to HSL Conversion |")
    print("-------------------------\n")

    try:

        image = Image.open("test.png")

        hls_array = create_hls_array(image)

        new_image = image_from_hls_array(hls_array)

        new_image.save("test_hls.png")

    except IOError as e:

        print(e)


def create_hls_array(image):

    """
    Creates a numpy array holding the hue, lightness
    and saturation values for the Pillow image.
    """

    pixels = image.load()

    hls_array = numpy.empty(shape=(image.height, image.width, 3), dtype=float)

    for row in range(0, image.height):

        for column in range(0, image.width):

            rgb = pixels[column, row]

            hls = colorsys.rgb_to_hls(rgb[0]/255, rgb[1]/255, rgb[2]/255)

            hls_array[row, column, 0] = hls[0]
            hls_array[row, column, 1] = hls[1]
            hls_array[row, column, 2] = hls[2]
            #print("Hue", hls[0])
            #print("Lightness", hls[1])
            #print("Saturation", hls[2])

    return hls_array


def image_from_hls_array(hls_array):

    """
    Creates a Pillow image from the HSL array
    generated by the create_hls_array function.
    """

    new_image = Image.new("RGB", (hls_array.shape[1], hls_array.shape[0]))

    for row in range(0, new_image.height):

        for column in range(0, new_image.width):

            rgb = (round(hls_array[row, column, 0]*255), round(hls_array[row, column, 2]*255), round(hls_array[row, column, 1]*255))

            new_image.putpixel((column, row), rgb)

    return new_image


main()

This kind of an RGB could then be opened in APhoto, its HSL values in RGB channels converted to RGB with the live filter (or if necessary, saved into spare channels and then saved in grayscale layers representing Hue, Saturation and Lightness).

rgbhslroundtrip_v01.afphoto

As you mentioned, the HSL live filter does not work at all in APhoto v2 because of some change in reserved words. It would be great to have the code updated and also changed so that it could be directly used as a HSL separator similarly as the Python script (I have just have done something wrongly to not having been able to use it that way).

BTW: GIMP (and of commercial apps, e.g. CorelPHOTO-PAINT) has a pretty comprehensive channel separation and combination support, so it could be used to do these kinds of task without a fuss:

GIMP_decompose.png.8b40f807a283a16e77cdb892c2cdbf71.png GIMP_compose.png.27ad1d5c39342dcef697dafc7aaf6256.png

 

I have not been using the procedural texture filter much so I probably failed to find a way to save a user-defined filter calculation for later use. I could create a preset category and import presets, but how to export or save? Being able to do that would make user-defined filters much more effective.

Link to comment
Share on other sites

On Windows, G'Mic plugin could be used to decompose layers into many different channels:

gmic_decompose.thumb.png.ef1c9ecfcd7be7075bf6ab6b887817bc.png

It is not possible to output split channels onto layers when using Affinity Photo, but the files are saved onto disk and then opened for manipulation. Recomposition could not be done via G'Mic, because multiple layer input cannot be used, but the recomposition can then be done e.g. by composing an RGB image from spare channels created from grayscale separations and then using the live filter.

Link to comment
Share on other sites

tell how this recompostion is done please ? amazing remember this gmic technology. even this one direction allows lot  but now i wait recompostion solution. and indeed corel paintshop pro have such seperations at least some colour spaces and i tested it with trial but found general usage (i mean basic needs resizing,photshop type painting/drawing,cropping etc) is very slow (and i disliked general interface) becouse of this goed with Affinity Photo. i look also you python script mabe someday maybe can think if i have someday super energy (not likely happen) to learn it as well.
Ps. btw i use windows.

Link to comment
Share on other sites

Here is a clip where grayscale decompositions made by G'Mic plug-in are opened in APhoto (v2) into separate layers and then each layer is saved as a spare channel. The spare channels are then loaded into R, G and B channels of a new layer, and the live filter by @NotMyFault from the post linked above (also included in my .aphoto roundtrip file in one of the posts above) is applied on the recomposed image to get the HSL values mapped to RGB.

It would probably be easiest to just use GIMP and decompose and recompose there. It would also be easy to do the decomposition by using the Python script that I provided, because it makes directly an RGB file with H, S and L mapped to R, G and B of an 8-bit bitmap, which could then be opened in APhoto and just have the live HSL2RGB filter applied on it. But that of course requires Python 3 to be installed with the required libraries, which would be an additional effort if not already done.

NOTE: When you open the G'Mic created decompositions, they are in Grayscale mode. Make sure you have the images as pixel layers. You can have them in layers in a grayscale image and then save the spare channels from Intensity channels, or you can convert the image directly to RGB and then spare the H, S, and L values from any of the RGB channels (it does not matter from which because they all have identical intensity values). But when you create the RGB with HSL values to recompose, you need to have RGB color mode to have the HSL spare channels loaded into R, G and B channels.

EDIT: You can use the same methods to decompose and recompose L*a*b and CMYK images. If you have a specific workflow, you can save a lots of time by creating macros.

Photo: John-Mark Smith | Pexels

Link to comment
Share on other sites

2 hours ago, lacerto said:

As you mentioned, the HSL live filter does not work at all in APhoto v2 because of some change in reserved words. It would be great to have the code updated and also changed so that it could be directly used as a HSL separator similarly as the Python script (I have just have done something wrongly to not having been able to use it that way).

An update will be available later today when i have access to my Mac.
The names mi and ma  caused the issue. I replaced them by m1 and m2 and it is working again. 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

1 hour ago, MxHeppa said:

but now i wait recompostion solution

It is because of after decomposition the channels are typically wanted in grayscale for editing, and then being quickly recomposited for preview, that using an app like GIMP might be the best choice. But creating macros to do these conversions within APhoto might effective, too. The process could also be made automated for decomposition once there is a working live filter, meaning that it would be possible to start with an RGB image on one layer, having it split to specific channels using a macro that applies a live filter, then creates spare channels and grayscale images for editing, and finally allows recomposing running the process in the other direction.

Link to comment
Share on other sites

1 hour ago, NotMyFault said:

An update will be available later today when i have access to my Mac.
The names mi and ma  caused the issue. I replaced them by m1 and m2 and it is working again. 

nice and i found it i mean what you and others talk. and now i wait.

Link to comment
Share on other sites

Here is demo of full roundtrip using live filters by @NotMyFault for RGB2HSL and HSR2RGB conversions. Spare channels are used to create grayscale layers that are used for editing and then, after editing, another set of spare channels are created to recompose the HSL image with live filter to convert to RGB.

One macro could be created to apply the HSL live filter on original RGB, creating spare channels and grayscale images and turn the image to grayscale mode, and then another macro that creates spare channels of edited grayscales, converts the image to RGB and then recomposes HSL and applies HSL2RGB live filter.

A resized smaller version of the image used in the clip attached below, hope nothing went wrong along size reduction:

RGBHSLRGB_Roundtrip_small.afphoto 

NOTE: This image has already @NotMyFault's RGB2HSL live filter fixed.

Photo: John-Mark Smith | Pexels

Link to comment
Share on other sites

done.

 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

5 hours ago, lacerto said:

I have not been using the procedural texture filter much so I probably failed to find a way to save a user-defined filter calculation for later use. I could create a preset category and import presets, but how to export or save? Being able to do that would make user-defined filters much more effective.

You can find import/export under the burger menu, in the category level entries.

Screenshot 2023-02-02 at 15.00.40.png

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

1 hour ago, lacerto said:

Spare channels are used to create grayscale layers that are used for editing and then, after editing, another set of spare channels are created to recompose the HSL image with live filter to convert to RGB.

You can do it that way, converted (destructively) to pixel layers, and it certainly has its advantages.

Never the less, for fans of fully non-destructive workflow you can do all edits non-destructively in RGB/8 or RGB/16.

Just jeep in mind that R is Hue, G is saturation, B is lightness while editing.

If you want to use pixel based tools, simply add a pixel layer, and edit only one of the RGB channels (use channels panel). set blend mode to "add". You can nest a channels mixer adjustment to zero-out the unwanted channels: when working on hue (store in R), add nested channel mixer with R=0, B0.

Use "solo/isolated" mode to get greyscale rendering of layers in case the false colours are irritating for you. 

 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

2 hours ago, NotMyFault said:

You can find import/export under the burger menu, in the category level entries.

Thanks, got it.

Here's an example of using two macros for making editing less clunky.

2 hours ago, NotMyFault said:

You can do it that way, converted (destructively) to pixel layers, and it certainly has its advantages.

Yes, these kinds of files just become easily quite huge so it might be a good idea just to delete the intermediate stages once finished.

Below are the two macros that I use on the video. I have not created many .afmacros so I am not sure if they should always be initiated somehow to ensure proper behavior. Well, it is not difficult to re-record, hope these give an idea how to do it. 

RGB2HSL_PrepareEdit.afmacro

RGB2HSL_FinishEdit.afmacro

EDIT: I have no idea if the live filters are actually saved within a macro (as I have saved them as presets), could someone confirm!

Link to comment
Share on other sites

13 minutes ago, MxHeppa said:

now i wonder how earth is possible but rgb->hsl conversion what i think part of procedural texture becouse formula what i found such have parts what i cannot put formulas.

Are you referring to the live filter that @NotMyFault had created and which he today updated? It should be available in an .aphoto attachment I placed above in one of my posts, and I think that also in the original post of @NotMyFault which he today has updated. Hopefully it should also be integrated in the first macro I posted above. This is a handy filter because it avoids the tedious process of needing to use a third-party app or plug-in to create the the grayscale channel composites (which additionally need to be loaded from a file system because no direct layer support).

Link to comment
Share on other sites

okay now i understand you just used them. i look then them. and i think i can do only hsl to rgb conversion if i allready have suitable images suitable names even they are not origianlly same image at all.(but same size). such uses is ones what i also thinked. totally creative ways use image colours for abstract art.

 

Link to comment
Share on other sites

24 minutes ago, MxHeppa said:

such uses is ones what i also thinked. totally creative ways use image colours for abstract art.

Yes, manipulating decomposed grayscale channels or interchanging them definitely allows all kinds of color experiments, but in some cases are also a means to get improvements that are difficult or impossible to achieve by other means. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.