home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Quality Assurance
Titan Skin Feedback
Post your customized home buttons here!
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JimCatMP" data-source="post: 1193253" data-attributes="member: 103549"><p>No template but I do have script that allows creation of buttons - examples.</p><p></p><p>[ATTACH]181443[/ATTACH] [ATTACH]181444[/ATTACH] </p><p></p><p></p><p>Script uses ImageMagick.[assume SRC image called Sky_Go.jpg].</p><p></p><p>------------------------------------------------------------------</p><p>convert Sky_Go.jpg -resize 400x285\! resize.png</p><p>convert -size 400x285 xc:black -fill white -stroke black -draw "roundrectangle 1,1 399,284 80,80" mask.png</p><p>convert resize.png -fill '#00000030' -opaque none -draw "rectangle 0,243 399,284" filled.png</p><p>convert filled.png mask.png -alpha Off -compose CopyOpacity -composite no_shadow.png</p><p>convert no_shadow.png \( +clone -background black -shadow 30x5+8+8 \) +swap -background none -layers merge +repage shadow.png</p><p>convert shadow.png -resize 400x285\! BNT_Sky_Go.png</p><p>------------------------------------------------------------------</p><p></p><p>Full script [allows for 9 separate parameters to be changed] and tidy's up after itself - requires Unix environment [Cygwin] but could readily be converted to other scripts quite easily<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p>NOTE - 1st 100 lines are just support stuff to allow for flexibility and human error<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite9" alt=":eek:" title="Eek! :eek:" loading="lazy" data-shortname=":eek:" />, if your using fixed values you can dispense with most of the code<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>---------------------------------------------------------------------------------------------------------------</p><p>#!/bin/sh </p><p></p><p>Usage()</p><p>{</p><p> echo -n " Mk_Button -S Source_pic [-X def=400 -Y def=285 -D def=30%"</p><p> echo " -Z def=15% -C def=20% -Sh def=30% -Sb def=5 -Soff def=2%]"</p><p> echo ; echo " S=Source Pic - MANDATORY"</p><p> echo " X & Y are final image sizes."</p><p> echo " D=density of band."</p><p> echo " Z=size of band as %ge of Y."</p><p> echo " C=curve as %ge of rectangle - 5% works well."</p><p> echo " Sh=shaow density 0-100"</p><p> echo " Sb=shadow blur - recommend 5"</p><p> echo " Soff=shadow offset recommend 2%"</p><p> echo</p><p> echo " Output == BTN_'Source_pic'.png, size X*Y pixels"</p><p> echo</p><p>}</p><p></p><p>S="VOID"; #Preset this as test value - no pic, not process.</p><p></p><p>#Default values - if running this as template, change these to whatever you want as your base as you overright</p><p>#any on processing.</p><p></p><p>X=400;Y=285; D=30;Z=15;C=20; Sh=30;Sb=5;Soff=2</p><p></p><p># Destination=BTN_Source as PNG.</p><p></p><p>echo $#</p><p></p><p>while [ $# -gt 0 ]</p><p> do</p><p> # get parameter values</p><p> case "$1" in</p><p> -x|-X) # X</p><p> shift;X=$1</p><p> ;;</p><p> -y|-Y) # Y</p><p> shift;Y=$1</p><p> ;;</p><p> -s|-S) #Source Image</p><p> shift;S=$1</p><p> Create new file name by prepending BTN_ to file name and forcing type as PNG.</p><p> DST=`echo $S | sed 's/\.jpg/\.png/;s/^/BNT_/'`</p><p> ;;</p><p> -d|-D) #Bar density</p><p> shift;D=$1</p><p> ;;</p><p> -z|-Z) #Depth of bar</p><p> shift;Z=$1</p><p> ;;</p><p> -c|-C) #Corner Radius as %ge of X</p><p> shift;C=$1</p><p> ;;</p><p> -sh|-Sh|-SH) #Shadow density.</p><p> shift;Sh=$1</p><p> ;;</p><p> -sb|-Sb|-SB) #Shadow blur</p><p> shift;Sb=$1</p><p> ;;</p><p> -soff|-Soff|-SOff|-SOFF) #Shadow offset.</p><p> shift;Soff=$1</p><p> ;;</p><p> -) # STDIN and end of arguments</p><p> break</p><p> ;;</p><p> -*) # Unknown option.</p><p> echo " Unknoswn Option"</p><p> echo </p><p> Usage</p><p> exit</p><p> ;;</p><p> -h|-H|-help|-HELP) # Unknown option.</p><p> Usage</p><p> exit</p><p> ;;</p><p> *) # end of arguments</p><p> break</p><p> ;;</p><p> esac</p><p> shift </p><p>done</p><p></p><p>if [ $S == "VOID" ] ; then</p><p> Usage</p><p> exit</p><p>fi</p><p></p><p>if [ ! -f $S ] ; then</p><p> echo "No Source Picture to process"</p><p> exit</p><p>fi</p><p></p><p>#Send empty list to awk, all parameters set as variables not input.</p><p></p><p>echo "" | awk '{</p><p> #resize SRC to final image.</p><p> printf("convert %s -resize %sx%s\\! resize.png\n",S,X,Y);</p><p> #generate mask to final image size with rounded courners</p><p> printf("convert -size %sx%s xc:black -fill white -stroke black ",X,Y);</p><p> printf("-draw \"roundrectangle 1,1 %s,%s %s,%s\" mask.png\n",X-1,Y-1,int((X/100)*C),int((X/100)*C));</p><p> #Add bar</p><p> printf("convert resize.png -fill %c#000000%s%c -opaque none -draw \"rectangle 0,%s %s,%s\" filled.png\n",0x27,D,0x27,Y-int(Y*Z/100),X-1,Y-1);</p><p> #Create button, applying mask to image.</p><p> printf("convert filled.png mask.png -alpha Off -compose CopyOpacity -composite no_shadow.png\n");</p><p> Soff=int(X/100)*Soff;</p><p> #Add shsdow.</p><p> printf("convert no_shadow.png \\( +clone -background black -shadow %sx%s+%s+%s \\) ",Sh,Sb,Soff,Soff);</p><p> printf("+swap -background none -layers merge +repage shadow.png\n");</p><p> #Resize back to desired size as shadow adds pizels.</p><p> printf("convert shadow.png -resize %sx%s\\! %s\n",X,Y,DST);</p><p>} ' X=$X Y=$Y S=$S D=$D Z=$Z C=$C DST=$DST Sh=$Sh Sb=$Sb Soff=$Soff | /bin/sh</p><p></p><p>#Tidy up the intermediae files.</p><p>#NOTE - if doing this as a batch run, suggest create mask once outside of the loop for efficieny.</p><p></p><p>rm resize.png mask.png filled.png no_shadow.png shadow.png</p></blockquote><p></p>
[QUOTE="JimCatMP, post: 1193253, member: 103549"] No template but I do have script that allows creation of buttons - examples. [ATTACH]181443[/ATTACH] [ATTACH]181444[/ATTACH] Script uses ImageMagick.[assume SRC image called Sky_Go.jpg]. ------------------------------------------------------------------ convert Sky_Go.jpg -resize 400x285\! resize.png convert -size 400x285 xc:black -fill white -stroke black -draw "roundrectangle 1,1 399,284 80,80" mask.png convert resize.png -fill '#00000030' -opaque none -draw "rectangle 0,243 399,284" filled.png convert filled.png mask.png -alpha Off -compose CopyOpacity -composite no_shadow.png convert no_shadow.png \( +clone -background black -shadow 30x5+8+8 \) +swap -background none -layers merge +repage shadow.png convert shadow.png -resize 400x285\! BNT_Sky_Go.png ------------------------------------------------------------------ Full script [allows for 9 separate parameters to be changed] and tidy's up after itself - requires Unix environment [Cygwin] but could readily be converted to other scripts quite easily:-) NOTE - 1st 100 lines are just support stuff to allow for flexibility and human error:eek:, if your using fixed values you can dispense with most of the code:-) --------------------------------------------------------------------------------------------------------------- #!/bin/sh Usage() { echo -n " Mk_Button -S Source_pic [-X def=400 -Y def=285 -D def=30%" echo " -Z def=15% -C def=20% -Sh def=30% -Sb def=5 -Soff def=2%]" echo ; echo " S=Source Pic - MANDATORY" echo " X & Y are final image sizes." echo " D=density of band." echo " Z=size of band as %ge of Y." echo " C=curve as %ge of rectangle - 5% works well." echo " Sh=shaow density 0-100" echo " Sb=shadow blur - recommend 5" echo " Soff=shadow offset recommend 2%" echo echo " Output == BTN_'Source_pic'.png, size X*Y pixels" echo } S="VOID"; #Preset this as test value - no pic, not process. #Default values - if running this as template, change these to whatever you want as your base as you overright #any on processing. X=400;Y=285; D=30;Z=15;C=20; Sh=30;Sb=5;Soff=2 # Destination=BTN_Source as PNG. echo $# while [ $# -gt 0 ] do # get parameter values case "$1" in -x|-X) # X shift;X=$1 ;; -y|-Y) # Y shift;Y=$1 ;; -s|-S) #Source Image shift;S=$1 Create new file name by prepending BTN_ to file name and forcing type as PNG. DST=`echo $S | sed 's/\.jpg/\.png/;s/^/BNT_/'` ;; -d|-D) #Bar density shift;D=$1 ;; -z|-Z) #Depth of bar shift;Z=$1 ;; -c|-C) #Corner Radius as %ge of X shift;C=$1 ;; -sh|-Sh|-SH) #Shadow density. shift;Sh=$1 ;; -sb|-Sb|-SB) #Shadow blur shift;Sb=$1 ;; -soff|-Soff|-SOff|-SOFF) #Shadow offset. shift;Soff=$1 ;; -) # STDIN and end of arguments break ;; -*) # Unknown option. echo " Unknoswn Option" echo Usage exit ;; -h|-H|-help|-HELP) # Unknown option. Usage exit ;; *) # end of arguments break ;; esac shift done if [ $S == "VOID" ] ; then Usage exit fi if [ ! -f $S ] ; then echo "No Source Picture to process" exit fi #Send empty list to awk, all parameters set as variables not input. echo "" | awk '{ #resize SRC to final image. printf("convert %s -resize %sx%s\\! resize.png\n",S,X,Y); #generate mask to final image size with rounded courners printf("convert -size %sx%s xc:black -fill white -stroke black ",X,Y); printf("-draw \"roundrectangle 1,1 %s,%s %s,%s\" mask.png\n",X-1,Y-1,int((X/100)*C),int((X/100)*C)); #Add bar printf("convert resize.png -fill %c#000000%s%c -opaque none -draw \"rectangle 0,%s %s,%s\" filled.png\n",0x27,D,0x27,Y-int(Y*Z/100),X-1,Y-1); #Create button, applying mask to image. printf("convert filled.png mask.png -alpha Off -compose CopyOpacity -composite no_shadow.png\n"); Soff=int(X/100)*Soff; #Add shsdow. printf("convert no_shadow.png \\( +clone -background black -shadow %sx%s+%s+%s \\) ",Sh,Sb,Soff,Soff); printf("+swap -background none -layers merge +repage shadow.png\n"); #Resize back to desired size as shadow adds pizels. printf("convert shadow.png -resize %sx%s\\! %s\n",X,Y,DST); } ' X=$X Y=$Y S=$S D=$D Z=$Z C=$C DST=$DST Sh=$Sh Sb=$Sb Soff=$Soff | /bin/sh #Tidy up the intermediae files. #NOTE - if doing this as a batch run, suggest create mask once outside of the loop for efficieny. rm resize.png mask.png filled.png no_shadow.png shadow.png [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Quality Assurance
Titan Skin Feedback
Post your customized home buttons here!
Contact us
RSS
Top
Bottom