Overwriting piexls Editableimages

  1. What do you want to achieve? How can i write new pixels to existing pixels?

  2. What is the issue?
    Before:

After combining:
image

  1. What solutions have you tried so far? i haven’t really made code to do that
1 Like

I know you already found out, but yeah.
You can use the DrawImage method with the combineType: ImageCombineType. I missed that when reading the documentation and made a dumb comment on this, I don’t want to delete it in case anyone actually looks for more advanced blending methods. I read the docs like 4 times and missed that single argument of the function…

i am so dumb

There really isn’t a built-in solution, as far as I know. You would need to make an algorithm that would combine them together. How you actually do that, I doubt someone here would know. Here is my suggestion, though:

  1. We can make a for loop that will run for every color in our array. First, we can make sure both arrays have a valid length and are the same. We can run the loop for the whole length of the array.

  2. What do we do now? This is the tricky part. We will need to make an algorithm to combine these two images. I’m not really sure how you would do that, but maybe you can try to get the average value by combining them and dividing by 2. Again, I have no idea how you would do that, but yeah.

  3. For each of these new values we made, we just made a new array in the correct format, and we are done. We can then write the pixels to the editable image.

This is not really how it is “supposed” to be. I would try googling and reading some deep dives into this topic to understand it better.

Also, there are many other questions that must be addressed. For example, are your images completely monochrome (black and white colors only) like the example you gave us? If that’s true, then you can simply combine the alpha values together, and you are pretty much done.

Like, we do the same loop, but we check the alpha color; if it exists at least on one of the arrays, we can write it to the new one. If you plan to use more than two colors, that gets more complicated. Two colors is fairly simple because we can simply use the alpha value.

If there are more than two, you need to implement your own algorithm that will overlay them and combine all of the colors. There are many types of “blending modes.” Each one is different. You can try reading this article I found; maybe it will help.

Kinda dumb, but did you try to make several editable images on top of each other? Since they support alpha there shouldn’t be much trouble as long as your image actually has a transparent background.

1 Like

Thanks for your reply, I just read the documents and it was just simple method to do,
all i had to do is:
EditableImage:DrawImage(Position,EditableImage2,Eunm.ImageCombineType.Overwrite)


The yellow image is the base image and the red image is the second image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.