Hi! Is there a way to pick the color from a image (an imported jpg for example) at certain point and then to asign it to a shape via vba?
I mean something like using color picker tool and take the color from a point but programatically ... like "select shape at point" at x and y coordinates.
Thank you in advance!
API 18 or heigher ActiveShape.Bitmap.Image.Pixel[x,y].RGBValue
I try to do this using Corel X6. Is this possible?
A small workaround may help you:Define a rect with width and height 1 at the location you want to get the RGB-Code.Export this rectangle as bitmap to a fileOpen this file as a binary low level file and read the content into an array of byteDon't forget to close it!The 54.th byte of the array has the value of blue, 55 green and 56 red.This Q&D code shows you how to do this:Sub TestIt()Dim MyRec As Rect, ExpFlt As ExportFilterDim TmpFN As String, fIO As Integer, Bytes(58) As ByteTmpFN = "C:\Temp\2019\Tmp.Bmp"ActiveDocument.Unit = cdrPixelSet MyRec = New RectMyRec.SetRect 200, 600, 1, 1Set ExpFlt = ActiveDocument.ExportBitmap(TmpFN, cdrBMP, cdrCurrentPage, cdrRGBColorImage, 1, 1, ExportArea:=MyRec)ExpFlt.FinishfIO = FreeFileOpen TmpFN For Binary As fIOGet #fIO, , BytesClose #fIOMsgBox Str(Bytes(56)) + Str(Bytes(55)) + Str(Bytes(54))End Sub