gotcha

Author Topic: Help with "Mask" On Two Different Types of Image  (Read 683 times)

July 10, 2019, 09:30:02 AM
Read 683 times

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
So our card game continues to develop (seemingly forever) and we're getting down to tiny details now. We've been asked to create a digital version of the card game for people to test it out and that means creating images of the cards that are different from what you send to the printers. I'm not at all sure I went about a solution the right way, but it worked until the current barrier.

We have two different types of cards. They're identical in dimensions, but to set them apart in game (as they behave differently) I kept one type with a white background and one type with a dark background.

When you do the image for the printer you send them a pure rectangle (no rounded edges) as they have the bleed area and border to deal with and they apply the cuts and rounded corners. So, these images are larger than the end product. When you want to create a digital version it needs to APPEAR more card-like so I created a layer with a "border" that's a rounded-corner rectangle. Then, to make the digital mock-up of this card I make that layer visible, select the rectangle (which is filled with white, but lower than everything but the printers template) and then Export Selection to PNG. The normal card (for printing) is 825x1125. The one that LOOKS like a card shape end up being 752x1047.

However, the black cards present a challenge I'm not sure how to overcome. I want to do the same thing, but I need the area outside the rounded rectangle to not show and I can't seem to make that happen. I can create a mask that makes it LOOK like the white cards, but all the mask does is turn the area outside the rectangle to white and leaves it at the original 825x1125 size.

How can I address this? One of each type is attached.
  • Windows 10

July 10, 2019, 02:19:39 PM
Reply #1

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
Well, if I understand the question correctly I have a question - When you export - are you choosing to export just the design or the entire object? Try grouping your entire design, then select it,  choose selection, then export, and you shouldn't get the background.  (I usually duplicate my design onto a new layer and then do this.)   When you export as page, you get the background color fill in.   

July 10, 2019, 02:25:24 PM
Reply #2

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Well, if I understand the question correctly I have a question - When you export - are you choosing to export just the design or the entire object? Try grouping your entire design, then select it,  choose selection, then export, and you shouldn't get the background.  (I usually duplicate my design onto a new layer and then do this.)   When you export as page, you get the background color fill in.   

Not sure that's quite the same situation, but I'll give it a shot. In steps:

1. I select the the layer (called Border) that has the rounded-corner rectangle on it that borders the bleed area so it's obviously smaller than the Page.

2. I click the rectangle.

3. I click Export and Selection is highlighted. I give it a name and click Export.

Done.

If I click the rectangle on card with the dark background this doesn't work. The one difference in that rectangle between white cards and black is that on the white cards the rectangle has a white fill so that the items above show on it, but not items below. ON the black cards there is no fill as I need the dark card art to show (which is essentially a space/star field).
  • Windows 10

July 11, 2019, 10:18:20 AM
Reply #3

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
What I usually do is put a (non stroked) white rectangle under my design so it doesn't produce the black background.  You still have to fill up any empty space.  Also, if you have a blur that goes outside of the rectangle, then you need to clip it.

July 12, 2019, 12:29:22 AM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
I looked at your Fire.svg file (the black card), but I don't see any attempt at masking.  Hhmm, don't see an attempt in the other file either.  So it's hard to investigate what might be going wrong.

However, based on your description, it sounds like clipping would be more appropriate than masking, in this case (assuming I understand correctly.)

I don't know if this is the problem, but just a tip.  The clipping path (or masking path) must be on top of everything to be clipped or masked (in z-order).
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

July 12, 2019, 12:41:45 AM
Reply #5

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
I looked at your Fire.svg file (the black card), but I don't see any attempt at masking.  Hhmm, don't see an attempt in the other file either.  So it's hard to investigate what might be going wrong.

I definitely didn't mask as I didn't think that was the right way to go. If you look at the Border layer you'll see there's a black-stroked/white-filled rectangle in the white card. That's what I used as the Export selection for white. I show that layer, select that rectangle and export. Presto. A nice 752x1047 representation of a real card post-printing (great for online example use). The black card gave me a fit, but I came upon a work-around that solved it today. It was just much more involved that I thought. I took that same rectangle and put it on top of the star field in the dark card and clipped it. The problem was, the new result was not 752x1047, but a bit smaller so I had to sit there and nudge the edges to make it bigger so that the clip would match the resolution of every other card. Ugh. For one unknown reason, a couple of cards REFUSED to let me set the X/Y to what I needed as it would just refuse to go to say, 757. It would do 756 or 758.... No idea what that was about, but I did get around it.

Would a mask have been better to just sit on TOP of everything and have it allow for a card shape on top of that standard rectangle shape? In other words, see (and export) the inner area within the mask??? If that's not clear, what I'm thinking is essential having a top-level layer that's the inverse of a card shape. In other words it's a rectangle with the card shape cut out of the inside so that you see the card like a keyhole below the "mask" (at least that's what I thought a mask was). I just had ZERO idea how you'd select that for export!
  • Windows 10

July 12, 2019, 02:21:53 AM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Oh, I understand now. 

Before I start trying to reproduce your problem, I don't understand your values.  When I select the white filled/black border round corner rectangle on Border layer, it's 239.286 x 333.571 px.

Oh, I see, you're exporting at 300 dpi, and you're getting your values from the Export PNG dialog, rather than the Selection tool control bar.  I guess you must need the higher dpi for the printing?  But using 300 dpi for these "digital" versions means that they will be bigger than you drew them.  So you might want to check the final size of the exports.

Ok, the reason why using export selection seems to work on the white card, is because the background is white/transparent, and the export "engine" (for lack of the proper technical terminology) "sees" and captures the black border.  But the exported image is still rectangular. The image itself does not have rounded corners.

It doesn't seem to work on the black one, because the Selection option for Export PNG is only for the bounding box, which is always rectangular (or square).  The Selection option does not use the actual path which is selected, within which to export.

Using the Selection option is a Great trick under certain circumstances, but it's always rectangular.

You should be able to clip it, and export that image.

Yeah, I think you might not have the right idea of a mask.  I don't see any reason to use a mask here.   (A mask is very similar to a clip.  The difference is that the mask usually has a gradient or filtered (blurred) area in the fill, and that gradient or filter creates a variable mask over top of the image.  It's sort of like putting a cloud over it....it's kind of hard to describe....well, for me it is anyway.)

I think I see your problem with the sizes being different.  When you clip something, the stroke is irrelevant.  It clips to the raw path, without the stroke.  So the white one's size, because it was created with Export PNG, it includes the stroke width in its size.

So you just need to make a clipping path of the proper size (without the stroke).  And rather than nudging it around, you can center it over the black/starfield background with 2 quick steps.

1 - select the clipping path first
2 - add the background to the selection (use Shift key)
3 - Object menu > Align and Distribute
4 - in the Relative To: dropdown menu, choose Last Selected
5 - click these 2 buttons in any order   :ava:   :aha:

Well, I guess it's more like a few quick steps, but still less tedious than nudging.

Sort of off topic, but I wanted to say that I think you really did a great job with that book on fire drawing.  Very effective!
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

July 12, 2019, 08:29:05 AM
Reply #7

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Ok, the reason why using export selection seems to work on the white card, is because the background is white/transparent, and the export "engine" (for lack of the proper technical terminology) "sees" and captures the black border.  But the exported image is still rectangular. The image itself does not have rounded corners.

It LOOKS like it has rounded corners on the PNGs I have of the cards.

See the one attached.

Thanks for the comment on the book art. I wish I could take the credit. We have a student in Brazil that did the art very inexpensively so that's his doing with my just describing what I think would look right for the theme.

Thanks so much for digging into this. I find this all endlessly fascinating so it's all greatly appreciated.
  • Windows 10

July 12, 2019, 09:55:15 AM
Reply #8

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
Agrajag - just to clarify, she's talking about the bounding box around the card and not the card itself as always going to be a rectangle. 

To create an easy clip, select only the card background (ungroup your objects if need be) - then duplicate (ctrl D) it right where it is and raise it to the top layer, select everything and clip it, then move or delete the clip (I'll sometimes put it on it's own layer if I need it later on). That way there's no need to nudge or use the align tool.

July 13, 2019, 07:26:33 PM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yes, I know it looks like it has rounded corners.  But the image is rectangular.  As flamingolady says, the export feature uses the bounding box (which is rectangular) to create the image size, when using the selection option.  The area between the rectangular corner and the rounded corner is just transparent.

It would be just like if you drew a star or ellipse, selected it and used export selection.  The image is not in the shape of a star or ellipse.  It's rectangular or square, and the area between the star or ellipse, and the rectangle or square, is transparent.


Is there a website for this card game?  I'm just curious to see how the game is played.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

July 13, 2019, 10:19:48 PM
Reply #10

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Is there a website for this card game?  I'm just curious to see how the game is played.

The game isn't out yet and is a take on an old classic. You can find more information here:

https://faux.city/index.php/spellcraft/
  • Windows 10