Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

JPEG to ARGB convertor toolbSarbutton

Community Beginner ,
Jun 19, 2019 Jun 19, 2019

Hi,

Someone please suggest how to convert JPEG image to ARGB hex 32 bit for  custom tool button image

TOPICS
General troubleshooting
931
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 20, 2019 Jun 20, 2019

Please give reference to what function or method you are trying to use, this is not something I have heard of.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 21, 2019 Jun 21, 2019

I am trying to implement below

var myIconStream =

"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011ff2de118ff1fdf0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000121cc69b2567acc773fe3be6d4fe2ee4ecfe25e3c7fe25e4bffe25e219fe28ea0000000000000000000000000000000000000000000000000000000000000000000000000300aaaa690ef2c9d511f9d0ff6abfddffea55e7ffe34ee4f36eafd95d23e6c80100000012fe2ae273fe32e600000000000000000000000000000000000000000000000000000000000000000d13d7b0be0cf8ceff1df4d7ffb58be5ffff48e9ffa588e0ff23f6d7ff18ffd5ff12fdcea809efbd0533cc9966ff41e80000000000000000000000000000000000000000000000000000000000000000b10bf7ceff2bead9ffdd72eafffa50eaf178add9da19fad1f919fcd3ff16ffd3ff0dfbcaff01f4bea31cd6b242fe4deb00000000000000000000000000000000000000000000000000000000490dedc3ff24eed8ffe272ebfff459ea90869fd4062aaaaa000000001426d8b2ba14f8c9ff06f8c4ff00f0b8ff02e7ab2e10d29b00000000000000000000000000000000000000000000000000000000a818efcfffcf80eafff55bebee50cdd70533cc990000000000000000000000001b12d9a9fc02f2beff00edb2ff00e6a58a03da9900000000000000000000000000000000000000000000000000000000d9ab92e0fffd58ecff5bc8dcf716fcd3cf19fad1cf19fad1cf19fad0cf14f7cacf08f2c0fb01eeb7ff00e9acff00e3a0bb02da9400000000000000000000000000000000000000000000000028ff5ff2fbfe59edff90a1e1ff13ffd6f817fcd4d71afad0d71afad0d718facfd710f6c7d704f0bcd702e9afd702e2a3d702dc98a404d69200000000000000000000000000000000000000000000000099fe59eeffdd67e8ff17fad7ff16ffd6e719fad1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ff00ffeafe4eebc880a3daff13ffd6ff17ffd6ff19ffd6481cedc2000000000000000000000000170bd29bcd03e1a2d202db98d202d8913f08ca89000000000000000000000000000000000000000017fe4de8f6fe41e71673a2c5e516fad2ff19ffd6ff19ffd6ef19fcd37817f4c7540cecbc7504e7b0dd02e6aaff00e4a1ff00de97d102d79104007f7f000000000000000000000000000000000000000017fe42e8d2fe35e6000000003b19edc2f319fcd3ff19ffd6ff18ffd4ff11fcccff03f6c1ff00eeb4ff00e7a8ff00e19ce901da932706d18f00000000000000000000000000000000000000000000000000000000c5fe28e315fe24da00000000322ddbc6e131e3d1ff15fed1ff0af9c8ff00f2bbff00ebaeff00e4a2ba02d9962007cf8f00000000000000000000000000000000000000000000000000000000000000001cfe24e36cfe25e23bfe26e52afe2ae003aa55aa3617e7bc7208efbb8403e7b16d04e0a62c0bd69600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

;

oIcon = {count: 0, width: 20, height: 20,

read: function(nBytes){return myIconStream .slice(this.count, this.count += nBytes);}};

app.addToolButton({

cName: "button",

oIcon: oIcon,

cExec: "console.println('My Button!');",

cTooltext: "My button!",

nPos: 0

});

So in the above code you can see the Hex string which is an image for the tool button. how to generate this string that was my question

However, I have developed a code using python  to generate above string, below is the code let me know if there is easier way to do it

pip install opencv-python

import cv2

import numpy as np

import pandas as pd

img_file = "/Users/Sid/Desktop/ie.png"

img = cv2.imread(img_file, cv2.IMREAD_UNCHANGED)          

red = pd.DataFrame(img[:,:,2])

blue = pd.DataFrame(img[:,:,0])

green = pd.DataFrame(img[:,:,1])

alpha = pd.DataFrame(img[:,:,3])

hexcode = ""

for i in range(20):

    temp =""

    for j in range(20):    

        temp =  temp + (format(alpha.iloc[i,j], '02x')) + (format(red.iloc[i,j], '02x'))

        + (format(blue.iloc[i,j], '02x')) + (format(green.iloc[i,j], '02x'))

    hexcode = hexcode + temp

print (hexcode)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2019 Jun 21, 2019
LATEST

Thank you for the context. So you are looking to create an icon stream. I'm not sure in what sense you want something easier, since I always find the easiest solution is the one I already coded. However, maybe util.iconStreamFromIcon is better for your needs.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines