Rank of admission and subtraction

How could you define the range in admission and subtraction over an image?

enter (0-255) without going past 255 or reducing me from 0.

my code is something like this …

admiminsion and subtracion
R₁ = float.(imggₗ) + float.(imggₑ)

R₂ = R₁ - float.(imggₑ)

#  imggₗ + imggₗ + imggₑ.
R₃ = R₁ + R₂

but there the error is that I’m taking float values …

how could I do it to establish the range (0-255).

help me…!

You probably want to look at clamp or clamp! depending on whether you want to create a new array, or overwrite the input array. If you use clamp, you will need the broadcast version:

clamp.(input_array, lovalue, highvalue)

It will operate on floating point values without a problem.

but how can I use int values and define approximation ranges (0-255)?

and do not use float values …

I’m making lots of assumptions here, based on your question in this and other posts. If I’m wrong, let me know, and I’ll try to correct what I’ve written below.

It looks like you’re trying to manipulate images. You’ve converted the image pixels to floating point values so that you can do arithmetic that doesn’t wrap around. You then want to change the pixels that are outside the normal range. In Julia, the range of values for image pixels is 0-1, so you probably want to clamp the pixels to those values.

# Result of arithmetic is R3, which is floating point
R₃ = R₁ + R₂
# Clamp the data to 0-1
Rclamped = clamp.(R₃, 0.0, 1.0)
# Rclamped has valid pixel range, convert to image data
Routput = Gray{N0f8}.(Rclamped)
# Routput is now a valid image. It will display
# correctly in Juno or Jupyter, and can be saved
# to a standard image format using save()