Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:18:12+00:00 2026-06-09T07:18:12+00:00

Specifically, with a given image I’m trying to decrease the RGB values for each

  • 0

Specifically, with a given image I’m trying to decrease the RGB values for each pixel by 100.

For example, if a pixel has R: 232, G: 40, B: 120 then I want the new RGB values to be R: 132, G: 0, B: 20.

I have tried this solution that I found on the ImageMagick forums:

convert input.jpg -channel R -evaluate subtract 25700 \
-channel G -evaluate subtract 25700 \
-channel B -evaluate subtract 25700 output.jpg

Edit: the reason I use 25700 is because apparently you need to multiply the rgb value by 257. 100 * 257 = 25700.

While it appears to work at first (clearly darkening the image), it seems that certain pixels will not change and for what I’m doing it’s vital that they do (I’m running a trim on the resulting image, trying to trim away the border with pixel values of 0).

An common problem is that I’ll end up with a pixel that has a RGB values of 3, 0, 0, but I’ll want that pixel to have values of 0 for RGB and increase the constant I subtract by – but it doesn’t seem to work.

Any ideas? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:18:14+00:00Added an answer on June 9, 2026 at 7:18 am

    Honestly, I don’t really understand what the value 25700 in your commandline should achieve.

    However, I suggest a different commandline to you, using the more powerful -fx operator. A bit more complicated looking, but hopefully more intuitively to understand…

    But first, I’m looking at your description and see you want to subtract a fixed number of 120 from each of the current R, G, and B color values. So this is a gray pixel color… and as you can look up in ImageMagick’s color built-in color list, its name is gray47:

    convert -list color | grep '(120,120,120)'
      gray47                srgb(120,120,120)                             X11 XPM 
      grey47                srgb(120,120,120)                             SVG X11 
    

    This leads me to the following command:

       convert \
           input.jpg \
          -channel red   -fx 'r - gray47' \
          -channel green -fx 'g - gray47' \
          -channel blue  -fx 'b - gray47' \
           output.jpg
    

    This way or writing the command will probably open your eyes to some easily derived modifications should you need those in future…

    To have an immediate preview window of the result popping up (without writing it to a file) you can also use -show: as output, like this:

       convert \
           input.jpg \
          -channel red   -fx 'r - gray47' \
          -channel green -fx 'g - gray47' \
          -channel blue  -fx 'b - gray47' \
          -show:
    

    Update

    If you want to check for the real differences of each pixel, you can make ImageMagick print out the color value for each pixel:

    convert  input.jpg   input.txt
    convert  output.jpg  output.txt
    

    The format of the .txt file is pretty easy to understand, once you know that the first columns give the Pixel zero-based coordinates: 123,456: means: 124th (!) column, 457th () row.

    Now you can compare the two .txt files to your heart’s content even in an automated, scripted version, without a need to resort to Gimp. 🙂

    You could even use input.txt and apply a Perl-, Ruby-, Python- or Shellscript onto each of the pixel values to distract your 120 value from each channel, save it as output2.txt and then convert it back to JPEG:

    convert  output2.txt  output2.jpg
    

    Then look for pixel differences between the two output images:

    compare  output.jpg  output2.jpg  delta.jpg
    compare  output.jpg  output2.jpg  view:
    

    An all-white plane will mean ‘no differences’ , any red pixels will hint to some sort of delta.

    Now if that answer doesn’t earn me an upvote, I don’t know which would… 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

System.Drawing has supports for very limited number of image formats What I am trying
More specifically, I'm trying to check if given string (a sentence) is in Turkish.
Given a tuple (specifically, a functions varargs), I want to prepend a list containing
Specifically I am trying to open a file from SharePoint, but it's really just
I have polygon chains similar to the following... ...given the chain in the image,
I am trying to manipulate an image using a chain of CIFilters, and then
I am creating an image processing application in C# and trying to take advantage
I am studying in the area of image and video processing - specifically in
Specifically, how do you get the image subview from a uitableview cell? My table
I'm trying to utilize the Image task in Ant, which requires Java Advanced Imaging.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.