Make round card corners with transparency
Discuss Card Scans and Other Artwork Here
Moderator: CCGHQ Admins
Make round card corners with transparency
by Ekkaiaa » 14 Aug 2017, 16:22
Hello.
I coded a script for get complete card sets into Xmage format (more info, if anyone interested: reddit.com/r/XMage/comments/6szmiu/predownload_images_for_commander_2017/dllvir7).
Many times image cards comes with ugly white or black corners, where supposed to be rounded. So using (the famous) Imagemagick I managed to get rid of it, and mantaining transparency (alpha channel, png format) so looks nice and roundy in softwares, websites...
So I think this could be useful for more people, here is the commands you need.
First, install Imagemagick in the system you're using.
Now you can execute this commands in your cmd/console (and of course, complete with your scripts).
First you need to make the "round border" overlay for the cards with this command, only need one time for the cards (if all are in the same size).
Now with this you "glue" the round overlay with the card and export. Notice that you may name it with .png extension, if not, alpha channel will not save.
P.S. For Xmage .png extension will not work, but just renaming (not converting) to ".jpg" all goes ok:
Windows:
Edit:
I also made a simply .bat to drag-n-drop a image and round it. The difference it's mainly that round-size-layer it's automated with imagemagick "identify". The rest are the same.
I coded a script for get complete card sets into Xmage format (more info, if anyone interested: reddit.com/r/XMage/comments/6szmiu/predownload_images_for_commander_2017/dllvir7).
Many times image cards comes with ugly white or black corners, where supposed to be rounded. So using (the famous) Imagemagick I managed to get rid of it, and mantaining transparency (alpha channel, png format) so looks nice and roundy in softwares, websites...
So I think this could be useful for more people, here is the commands you need.
First, install Imagemagick in the system you're using.
Now you can execute this commands in your cmd/console (and of course, complete with your scripts).
First you need to make the "round border" overlay for the cards with this command, only need one time for the cards (if all are in the same size).
- Code: Select all
convert -size 488x680 xc:none -draw "roundrectangle 0,0,488,680,25,25" mask.png
Now with this you "glue" the round overlay with the card and export. Notice that you may name it with .png extension, if not, alpha channel will not save.
- Code: Select all
convert "card.jpg" -matte mask.png -compose DstIn -composite "card.png"
- Code: Select all
convert "card.png" -resize 265x370 -alpha on "card.png"
P.S. For Xmage .png extension will not work, but just renaming (not converting) to ".jpg" all goes ok:
Windows:
- Code: Select all
ren *.png *.jpg
- Code: Select all
rename 's/.png$/.jpg/' *.png
Edit:
I also made a simply .bat to drag-n-drop a image and round it. The difference it's mainly that round-size-layer it's automated with imagemagick "identify". The rest are the same.
- Code: Select all
FOR /F "tokens=1 delims=" %%A in ('identify -format %%[fx:h] %1') do SET alto=%%A
FOR /F "tokens=1 delims=" %%A in ('identify -format %%[fx:w] %1') do SET ancho=%%A
convert -size %ancho%x%alto% xc:none -draw "roundrectangle 0,0,%ancho%,%alto%,19,19" mask.png
convert %1 -matte mask.png -compose DstIn -composite "result.png"
del mask.png
ren *.png *.jpg
Last edited by Ekkaiaa on 28 Aug 2017, 15:45, edited 1 time in total.
Re: Make round card corners with transparency
by kudit » 15 Aug 2017, 00:16
PNGs are lossless and therefore tend to be much larger for image data which is why JPEGs are used which do not support transparency. Perhaps the new HEIF format will be used in the future that supports both.
Please give feedback on our card database at http://www.deckmaster.info
Send comments via PM here or info@deckmaster.info
Send comments via PM here or info@deckmaster.info
Re: Make round card corners with transparency
by Ekkaiaa » 15 Aug 2017, 16:29
Yes, size is like five times more. Optimal is that software uses round corners container when needed (thinks simply in html+css, just border-radius css do the trick) but seems that many ones does not do that, so... that's why I used Imagemagick (for Xmage in this case).
Re: Make round card corners with transparency
by kudit » 16 Aug 2017, 14:39
Yes, most should be able to handle it in CSS or however they're displaying. How are you using it where you can't round the edges?
Please give feedback on our card database at http://www.deckmaster.info
Send comments via PM here or info@deckmaster.info
Send comments via PM here or info@deckmaster.info
Re: Make round card corners with transparency
by Yilia » 02 Mar 2018, 11:59
As a matter of fact, HEIF can hold up to large data. A heic file can include several live photos or photo bursts. If you use a heic to jpg converter to complete a conversion process and output all HEIC images, you will find not only the main image but also other live photos in your destination folder. Moreover, it can also take up less storage space than JPG.kudit wrote:PNGs are lossless and therefore tend to be much larger for image data which is why JPEGs are used which do not support transparency. Perhaps the new HEIF format will be used in the future that supports both.
Delight to have deeper communication on this item with you.
Re: Make round card corners with transparency
by Bog Wraith » 02 Mar 2018, 15:07
Went to the ImageMagick site and was quite pleased as a Mac user to see that this is not only cross platform for Linux, Windows, Mac Os X, iOS, Android OS, but that it is a free app as well and is extremely powerful in what it can do.
I'm not a programmer but I do some "light lifting" at the command line level in OS X or as it's now known as macOS, using the Terminal, so I'm grateful for your inclusion of the code you use for the various function of this software. The codes you provide are self explanatory and it's easy to understand the process being implemented.
Since I will be using these on 300 & 200 dpi scans of various pixel sizes, changing the pixel sizes in the "convert -size 488x680 xc:none -draw "roundrectangle 0,0,488,680,25,25" mask.png" when entering the code to whatever size I need for these files should be a breeze.
Thank you Ekkaiaa for the code you posted and for giving me a heads up about ImageMagic as I didn't know about this app and it will be a valuable tool to add to my toolbox in my workflow when I use Pixelmator!
I'm not a programmer but I do some "light lifting" at the command line level in OS X or as it's now known as macOS, using the Terminal, so I'm grateful for your inclusion of the code you use for the various function of this software. The codes you provide are self explanatory and it's easy to understand the process being implemented.
Since I will be using these on 300 & 200 dpi scans of various pixel sizes, changing the pixel sizes in the "convert -size 488x680 xc:none -draw "roundrectangle 0,0,488,680,25,25" mask.png" when entering the code to whatever size I need for these files should be a breeze.
Thank you Ekkaiaa for the code you posted and for giving me a heads up about ImageMagic as I didn't know about this app and it will be a valuable tool to add to my toolbox in my workflow when I use Pixelmator!
'Twas in the bogs of Cannelbrae
My mate did meet an early grave
'Twas nothing left for us to save
In the peat-filled bogs of Cannelbrae.
My mate did meet an early grave
'Twas nothing left for us to save
In the peat-filled bogs of Cannelbrae.
-
Bog Wraith - Global Mod 1 (Ret)
- Posts: 1108
- Joined: 28 May 2008, 22:40
- Location: Shandalar
- Has thanked: 425 times
- Been thanked: 153 times
Re: Make round card corners with transparency
by proud » 07 Mar 2018, 18:16
If you don’t want the corners, this should be something the client cuts out, much like a stylesheet can cut the corners off a card on a web page.
aka ancestral, mproud
MTG.Design
MTG.Design
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 49 guests