GNOME Bugzilla – Bug 137776
Color Sampler tool
Last modified: 2006-05-20 21:51:04 UTC
A useful addition/option for the tool palette: A Color Sampler tool, a variant of the eyedropper, akin to the one in Photoshop, which leaves a marker behind constantly showing color info in the Info (Extended) palette, used for marking highlight, shadow, and neutral in color correcting with the Levels/Curves etc.
Isn't this just a duplicate of bug #136861 ?
Created attachment 25852 [details] Numbered markers on an image with values display
Hmm, essentially yes. I missed that one. I don't know what the "zone system" or "exposure latitude" is (contrast?). He suggests the existing colorpicker be extended, I suggested a separate related tool. He elaborates two points I merely referred to as "akin to Photoshop", firstly the sample points are numbered, though he talks of floating pop-ups. I only suggested having them referenced in the Info palette by the sample number. Also, when applying something like Levels, all the color values in the Info palette show before and after values separated by a slash in the format current/new as in 3/5, other times they show as normal. I see no point in showing XY coordinates as he suggests. In Photoshop, the markers are only visible when either you are using the eyedropper or color sampler tool, or using an Adjustment dialog like levels or curves. Other times they are not visible, but still display samples in the Info palette. The Color Sampler tool can also be used to move the points when over them, the cursor changes accordingly (diagonal arrow with marker). The contextual menu is used to Delete a point, and alter what values are shown in the Info palette, eg RGB, Web(Hex), HSV or Greyscale. The contextual menu over the Info window similarly could, as in Photoshop, change the color model being displayed, rather than a drop-down menu as in The Gimp. His idea of a floating popup over the samples could be refined. Having it a bit more like a sticky tooltip with no widgets is better. Similarly, you can have it only show when the color samper tool is selected or when any of the adjustment tools like Levels/Curves are being used. His reference to a colorblind person being able to color correct is perhaps a reference to the excellent book (the pre-eminent pre-press color correction guide) by Dan Margulis called Professional Photoshop. He made a point of training a colorblind person to prove the point of being able to correct by the numbers. Although many parts deal with CMYK, Lab, and pre-press, many sections are still relevant to any GIMP user interested in color correction and image restoration. I'll make two attachments, one a mockup of the marker and "tooltip" dialog showing an image being corrected with the curves, and showing before/after values, as well as the info palette from Photoshop showing the before/after display with the numbered markers. Not that Gimp's info is identical, just didn't make a mockup.
Created attachment 25856 [details] Photoshop info palette showing before/after samples of markers
Forgot to mention, like the Color Picker, the Color Sampler Options has a Sample Average slider and Sample Merged checkbox.
*** Bug 136861 has been marked as a duplicate of this bug. ***
This is a quite easy addition. It needs: - a persistent list of sample points which is part of the image - code to load/save this points in the XCF - display drawing code similar to guides/grid - a tool to create/delete/mode sample points (this could be a color picker mode or a separate tool) - PDB accessors for the new functionality All these changes are quite local and could be done for 2.2
*** Bug 152713 has been marked as a duplicate of this bug. ***
See bug #152713 for a book recommendation where these sample points are used to do color correction.
We won't add new tools or new GimpImage features that need to be saved in the XCF before 2.2. Bumping to FUTURE.
I implore you to reconsider putting it off to after 2.2. Saving the picked coordinates in the XCF is a nice feature, but the usefulness of that aspect doesn't seem compelling to me (I don't think the picked points are saved in photoshop). Not having the basic functionality of monitoring selected points/regions while adjusting curves/levels makes it really difficult to adjust color casts in digital photos, a process I'm finding really important. Having to re-pick the monitor regions the next time I want to work on the photo doesn't seem nearly as much of a problem as not having the feature at all. Pretty please?
A whole lot of features are going to be postponed to the next development cycle. The idea of having a short development cycle is not to let people wait too long for the new features. By putting too much stuff onto the feature list, all we end up with is everyone waiting even longer for the nice new stuff that is in CVS. We are way behind our schedule already and we are basically feature frozen for 2.2.
I have now put together an implementation of this by creating a list of GimpSamplePoints attached to each image in much the same way as the list of guides; the code for dealing with them is very closely modeled on the guide code. The infrastructure for this is the important thing, but here are the details, all of which easily can (and many should!) be changed: in my implementation, sample points are drawn as small "+" symbols. They are created inside image map tools, by ctrl-clicking on the image. (If none yet exist, a new "Color Samples" area of the image map tool dialog shows a message telling how to add them.) Each sample point gives rise to a small color-picker-like display at the bottom of the image map dialog, in the "Color Samples" area, showing a swath of color and the RGB pixel values. The colors are taken from the projection. I haven't yet done anything to make the sample points be saved in XCF files. I will attach below a diff for this change. It is pretty large, since quite a substantial number of files needed to be modified.
Created attachment 38226 [details] [review] patch implementing "sample points", touches many files
That's a nice start but I strongly disagree with the addition of more GUI elements to the imagemap tool dialogs. We have tried very hard to make these dialogs compact and I would prefer to see color information being added to the color picker window (which is supposed to become a dockable anyway). I also don't think we need to store the sample points in the XCF file. Can't see any reason why that would be useful, but perhaps I am missing something?
Well, the image map tools are exactly where the information is useful, and this can be done such that no extra space is consumed unless the user actually creates sample points. But I would be happy to put the image map tool part aside for the moment if it means I can put the basic sample point code into cvs before it bitrots -- the image map tool stuff all lives inside gimpimagemaptool.[ch] and can easily be separated out and handled later. Re xcf, I don't see any very strong reasons to store sample points in them at this time. I only brought it up because Mitch in his comments above seemed to say that this is important.
Well, this is quite an important decision. If the color sample points are only relevant to the imagemap tools, then they only need to exist in the imagemap tools. They would not have to be part of the image structure, there wouldn't have to be PDB commands for handling them, no need for global IDs, no transformation support and so on. The more I think about this, the more sense does this approach make. Perhaps Mitch can explain why he thinks that sample points should be a permanent part of the image like guides?
Ok. First some comments about the patch itself: - It's almost perfect :) - IMHO the sample points should always appear *after* guides and grid, in all structs menus, property installation code etc. - If the functions are called foo_sample_points(), the files must be called gimpimage-sample-points.[ch], not -samplepoints.[ch] - The image map tools should not be cluttered with sample points GUI, - The manipluation of the sample points should live in GimpColorTool, not in GimpImageMap tool. - They are members of the image, so the best thing to do IMHO is to create a sample points dockable that shows the active image's points and can be open all the time, regardless of the active tool WRT to saving the points in XCF: I think we should finally save them in XCF because I see no reason why they would be less important than guides and grid. For some people I'm sure they are much more important because they do lots of color correction work. First however, I suggest getting the basic infrastructure in CVS, plus a sample point dialog that should perhaps be integrated in the long-outstanding info window replacement dockable which is on my TODO. Raising priority to prevent bit-rot...
Ok, so please commit this to CVS with the changes that Mitch suggested but for now w/o any GUI. I think we should finally move the color and cursor information out of the Info window and make it a dockable. Additional color sample points can then happily live there. Does that make sense?
That absolutely makes sense and is on my TODO for a long time. Will look into that after the (busy) weekend.
Okay, I made the following changes: 1) Changed gimpimage-samplepoints.[ch] to gimpimage-sample-points.[ch] 2) Reverted gimpimagemaptool.[ch] back to its previous form, without any sampling point code. The other issues can be handled one thing at a time, without making or breaking anything. Committed to HEAD: 2005-03-04 Bill Skaggs <weskaggs@primate.ucdavis.edu> * app/core/gimpimage-sample-points.c * app/core/gimpimage-sample-points.h: new files * app/actions/view-actions.c * app/actions/view-commands.c * app/actions/view-commands.h * app/config/gimprc-blurbs.h * app/core/Makefile.am * app/core/core-enums.c * app/core/core-enums.h * app/core/core-types.h * app/core/gimp.c * app/core/gimp.h * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-flip.c * app/core/gimpimage-rotate.c * app/core/gimpimage-scale.c * app/core/gimpimage-undo-push.c * app/core/gimpimage-undo-push.h * app/core/gimpimage.c * app/core/gimpimage.h * app/display/gimpdisplayoptions.c * app/display/gimpdisplayoptions.h * app/display/gimpdisplayshell-appearance.c * app/display/gimpdisplayshell-appearance.h * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-draw.c * app/display/gimpdisplayshell-draw.h * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell.c * app/display/gimpdisplayshell.h * app/widgets/gimphelp-ids.h * menus/image-menu.xml.in: add support for a list of "sample points" in each image, coded and handled very similarly to guides, for use mainly in color correction. See bug #137776.
2005-03-09 Michael Natterer <mitch@gimp.org> More sample point stuff. Addresses bug #137776. * app/core/gimpimage-sample-points.c * app/core/gimpimage-undo-push.c: append, not prepend the sample paints to the image's list because their index matters. Update sample points when their index changes. * app/display/gimpcanvas.[ch]: added own sytles for the sample points. Added gimp_canvas_draw_text() which uses a PangoLayout which is cached in the canvas. * app/display/gimpdisplayshell-draw.c (gimp_display_shell_draw_sample_point): draw the sample points more distinct from guides using the new canvas APIs above. * app/display/gimpdisplayshell-callbacks.c (gimp_display_shell_[hv]ruler_button_press): factored out all code to (gimp_display_shell_ruler_burron_press): which takes a boolean "horizontal" variable and allows to add sample points with <control>+drag. * app/tools/gimpcolortool.[ch]: implement adding, moving and removing of sample points in the same way as the move tool moves guides. * app/tools/gimpcolorpickertool.c (gimp_color_picker_tool_oper_update): chain up.
First version of the sample points dockable: 2005-04-03 Michael Natterer <mitch@gimp.org> * app/core/gimpimage.[ch]: added new signals "sample-point-added" and "sample-point-removed" and public functions to emit them. * app/core/gimpimage-sample-points.c (gimp_image_add_sample_point) (gimp_image_remove_sample_point): emit them accordingly. * app/core/gimpimage-undo-push.c (undo_pop_image_sample_point): ditto. (undo_pop_image_guide) (undo_pop_image_sample_point): added comments why we add/remove stuff manually instead of using the GimpImage APIs. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpcursorview.[ch] * app/widgets/gimpsamplepointeditor.[ch]: new widgets. GimpCursorView is a replacement for the info window's "Cursor" page, GimpSamplePointEditor is a view on an image's sample points. The sample point editor does nothing yet except keeping a 2x2 grid of GimpColorFrames. Addresses bug #137776. * app/dialogs/dialogs.c * app/dialogs/dialogs-constructors.[ch]: register the new widgets as dockable dialogs. * app/actions/dialogs-actions.c (dialogs_dockable_actions) * menus/dialogs-menuitems.xml: added actions and menu items for the new dialogs. * app/display/gimpdisplayshell-cursor.c (gimp_display_shell_update_cursor) (gimp_display_shell_clear_cursor): update the new cursor view. * app/widgets/gimphelp-ids.h: help IDs for the new dialogs. * app/widgets/widgets-enums.[ch] (enum GimpColorFrameMode): changed description "Pixel values" to "Pixel" because the former was too long.
More progress: 2005-04-18 Michael Natterer <mitch@gimp.org> * app/widgets/gimpsamplepointeditor.[ch]: Connect to the GimpImage::update-sample-point and GimpProjection::update signals and idle-pick colors at the sample points' coordinates. Addresses bug #137776.
Most of the infrastructure needed seems to be in place by now. What remains to be done is to review the user interface and to check if this feature can be integrated better. The current way of using it is not easily discoverable. It would be nice if someone could write down - how the feature is currently implemented from a users point of view - what is good or bad about this - what's missing, what should be changed One of the minor things that needs to be improved is the stock icon. Another thing that might be worth adding is a way to specify whether to sample-merge the picked colors.
For the records, this commit adds a context menu to the sample point dockable which for now just contains "Sample Merged": 2005-07-09 Michael Natterer <mitch@gimp.org> * app/widgets/gimpsamplepointeditor.[ch]: added "sample-merged" property and API. Pass it to gimp_image_pick_color(). * app/actions/Makefile.am * app/actions/actions.c * app/actions/sample-point-editor-actions.[ch] * app/actions/sample-point-editor-commands.[ch]: actions and callbacks for the sample point editor's menu. * app/widgets/gimphelp-ids.h: its help IDs. * app/menus/menus.c * menus/Makefile.am * menus/sample-point-editor-menu.xml: the sample point editor menu.
Image scaling was forgotten: 2005-08-07 Michael Natterer <mitch@gimp.org> * app/core/gimpimage-resize.c (gimp_image_resize_with_layers): take care of sample points. Addresses bug #137776.
Sven asked how the feature is currently used from a user's point so here goes.. This is a mock up how it could work in Gimp.. I'm including a link because i'm not sure if there is a size limit on attachements in Bugzilla.. hope the link works.. <a href="http://imageshack.us"><img src="http://img463.imageshack.us/img463/4585/sampletool15mx.png" border="0" alt="Image Hosted by ImageShack.us" /></a> This image shows the cursor over the existing Color Picker tool. The tool info below shows Color Picker as well.. Since Color Picker and Color Sampler are in a way similar, it makes sense to group them together to save real estate... so no new tool need to be displayed in the crowded tool window, instead it is hidden together with Color Picker.. This may or may not be possible to implement with Gtk, but that's how it is used currently.. Now see what happens as the left mouse button is pressed once and hold... <a href="http://imageshack.us"><img src="http://img461.imageshack.us/img461/2421/sampletool24xa.png" border="0" alt="Image Hosted by ImageShack.us" /></a> The second image, shows the new Color Sampler tool being revealed, while the left mouse button is pressed down... now to select it, simply slide the mouse over to the right icon.. When the left mouse button is released, this is what happens... <a href="http://imageshack.us"><img src="http://img462.imageshack.us/img462/4198/sampletool39fi.png" border="0" alt="Image Hosted by ImageShack.us" /></a> Notice the tools info window below... It changes to the Sample Point Tools Info... Here my suggestion is to incorporate the Cursor Info with the new Color Sample Tool info... so the user can see the X and Y co-ordinates together at the same time as the RGB/CMYK/etc values.. (The X/Y coordinates are important to the color blind person who is trying to "color correct by the numbers") Now the user has finished selecting his tool, it is the new Color Sampler Tool, and the Info window has the 4 sample points grey out because no point is selected yet.. Now the user goes over to an open image - one that badly needs color correction because some cheap digital camera did not do white balance properly, in this case the photo is spoilt by a blue tinit. <a href="http://imageshack.us"><img src="http://img362.imageshack.us/img362/5788/horse2nt.png" border="0" alt="Image Hosted by ImageShack.us" /></a> Notice the cursor has changed to the Color Sampler icon, and notice the position of the cursor is being placed over an area which the user believed correctly represents the white point in the photo at 268,199 This co-ordinate is again useful for the color blind person.. Now at this point, turn to look at the Tools info.. <a href="http://imageshack.us"><img src="http://img462.imageshack.us/img462/3103/sampletool45wz.png" border="0" alt="Image Hosted by ImageShack.us" /></a> The tools info showed the X/Y correctly at 268,199 and the color under this point is R 157/157 G 175/175 B 195/195 By clicking left button once at this point, the sample point 1 will be captured as above.. Next the user will use the levels tools, or curves tools or some other adjustment tool and work on the white point adjustment, while watching the info window all the time. The pair of numbers to the left should not change. That is the original color.. The numbers on the right marked XXX will change, as the user make color adjustments like this : R 157/XXX G 175/YYY B 195/ZZZ The object of making the white point adjustment is to adjust using levels/curves/etc until the numbers are near to R 157/195 G 175/195 B 195/195 i.e. XXX = YYY = ZZZ = highest RGB value, in this case 195. Now, the user is done with the first sample point. He will now select an area in the tinted photo which he believes truly represents the black point.. and then make the second sample point and repeat the above adjustment steps.. This time for black, he is looking to adjust until XXX = YYY = ZZZ = lowest RGB value, which for example could be 26 or any other such number for the second sample point. After the adjustment of black and white points, the white balance will be corrected. Notice that if the X/Y co-ordinates are shown, a color blind person can do the job as long as he is given the correct sample point.. He just work on the numbers !! Notice in this example, only two sample points are needed, and after adjustment, the sample points are of no use to him any more, therefore, it is really not necessary to keep it in the XCF data structure.. What is important to the user is to save a copy of the levels or curves preset.. Because if the camera has a white balance problem, it is likely to affect one whole batch of photos not just one... And then, all he need to do, for subsequent series of photos is to re-apply the same saved levels, or curves adjustment presets, and there is no need to find matching white and black points anymore.
The fly-out item does not work under Windows (at least on the build I got from Sourceforge). Or I'm doing something wrong. Holding down left-mouse on the color picker does nothing at all... :(
Could you please clarify? Is your "does not work" referring to comment #28, which is one person's idea of how things *ought* to work and does not correspond to what is actually implemented in GIMP at the moment? If not, could you please tell us which version of GIMP you are using, what you expected to happen, and what actually happened? (In the current implementation, in the development version of GIMP, you create color sample points by holding down the control key (with any tool active) and dragging from a ruler into the image. You see information about the colors of the sample points by opening the "Sample Points" dialog.)
Very sorry to add my confusion to this thread. I'm a moron. I've been desperately wishing for a) dockable cursor info; and b) color sample points. When I saw the GIMP 2.3.x changelog stating that (a) was done and (b) appeared to be included as well I was elated. I downloaded the 2.3.5 Windows binary from Sourceforge and quickly saw the dockable cursor info and then the sample points dialog. The problem was I couldn't figure out how to get the sample points to work. I tried ctrl/shift/alt clicking to no avail. Then I found this thread and (wrongly) assumed that the current implementation had the fly-out toolbox icon under the dropper tool (ref #28). That was the reason for my post. Dragging from the ruler works (of course). :) Thanks for clarifying!
In addition to lasm stated (which is good in my opinion) may I also suggest that the sample points be updated _without_ having the preview option enabled in curves? On large images it can take some time to redraw, and without preview enabled the sample points don't update. It would be very cool to work in non-preview mode and work the sample numbers to where you want them...and then enable the preview to see it. I don't know if this is possible without redrawing the image, so take the suggestion for what it's worth.
Looking over what is here. I am going to resolve this bug report as FIXED. There are some unimplemented suggestions in the last few comments, and it might be appropriate to open new bug reports for them if the commenters are still interested. This report has gotten too long.