Werty Posted July 19, 2010 Share Posted July 19, 2010 (edited) How do I convert a variable, that has a Decimal value between 0 and 65535 into a text string that looks like this... If Decimal = 0 Hex should be = #000000000000 If Decimal is = 1 Hex should be = #000100010001 If Decimal is = 65535 Hex should be = #FFFFFFFFFFFF As you see, the string should contain the Decimal 3 times in a row, with the hash sign infront. I need it to feed an Imagemagick command that looks like this.. $compare = $img.Compare("bitmap1.bmp", _ "bitmap2.bmp", _ "-depth", "16", _ "-highlight-color", "#123412341234", _ "bitmapresult.pgm" ) I wanna feed the "#123412341234" part with a variable, but dunno how to convert the decimal variable into such a text string. Anyone ? Edited July 19, 2010 by Werty Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
KaFu Posted July 19, 2010 Share Posted July 19, 2010 Its for Imagemagick? Would be interesting to see this ... $dec = 65535 $compare = $img.Compare("bitmap1.bmp", _ "bitmap2.bmp", _ "-depth", "16", _ "-highlight-color", _ColorDecToHex4($dec), _ "bitmapresult.pgm") Func _ColorDecToHex4($dec) $Hex = hex($dec,4) Return "#" & $Hex & $Hex & $Hex EndFunc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Werty Posted July 19, 2010 Author Share Posted July 19, 2010 lol, was it that simple, guess I should have read up on Hex() before asking, only remember it from my old ZX Basic days, where there was no option for defining how many chars. I'm making height maps and was limited to 8bit 256 grays... But now I got 65536 grays to work with. Thanks for your help. Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now