Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. MVC Core 3.1 I need to display multiple images (with transparency) on top of each other as 1 image

MVC Core 3.1 I need to display multiple images (with transparency) on top of each other as 1 image

Scheduled Pinned Locked Moved ASP.NET
asp-netquestionjsonarchitecture
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    clemenslinders
    wrote on last edited by
    #1

    LS, I need to display one image that is made up of multiple images with each a transparency. So image one has a bike on the left and the rest of the image is transparent and the second image has a car on the right (again the rest is transparent), then I would need to display one image with a bike on the left and a car on the right. How can I accomplish this in MVC Core 3.1? As the user can select the images that build the total image I cannot prebuild this image. Kind regards, Clemens Linders

    Richard DeemingR 1 Reply Last reply
    0
    • C clemenslinders

      LS, I need to display one image that is made up of multiple images with each a transparency. So image one has a bike on the left and the rest of the image is transparent and the second image has a car on the right (again the rest is transparent), then I would need to display one image with a bike on the left and a car on the right. How can I accomplish this in MVC Core 3.1? As the user can select the images that build the total image I cannot prebuild this image. Kind regards, Clemens Linders

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You could use either CSS or SVG to stack the images on top of each other. If you want to generate a single image on the server then you'll need to use a graphics library which is compatible with .NET Core to do it. For example:

      • System.Drawing.Common[^]
      • ImageSharp[^]
      • SkiaSharp[^]

      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      C 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        You could use either CSS or SVG to stack the images on top of each other. If you want to generate a single image on the server then you'll need to use a graphics library which is compatible with .NET Core to do it. For example:

        • System.Drawing.Common[^]
        • ImageSharp[^]
        • SkiaSharp[^]

        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        C Offline
        C Offline
        clemenslinders
        wrote on last edited by
        #3

        Hi Richard, Just how would I do this in CSS or SVG? Kind regards, Clemens Linders

        Richard DeemingR 1 Reply Last reply
        0
        • C clemenslinders

          Hi Richard, Just how would I do this in CSS or SVG? Kind regards, Clemens Linders

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          Assuming you want the images to be centred within their containing block, try something like this:

          <div class="image-stack">
          <img src="..." />
          <img src="..." />
          ...
          </div>

          .image-stack {
          position: relative;
          /* Use whatever size you want: */
          width: 500px;
          height: 500px;
          }
          .image-stack img {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          }

          In this case, the images need to be listed in order from bottom to top; each subsequent image will appear on top of the previous image. Another option would be to use multiple background images:

          <div class="image-stack"></div>

          .image-stack {
          /* Use whatever size you want: */
          width: 500px;
          height: 500px;

          background-image: url('...'), url('...'), ...;
          

          }

          NB: In this case, the images need to be listed in order from top to bottom. Using multiple backgrounds - CSS: Cascading Style Sheets | MDN[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          C 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            Assuming you want the images to be centred within their containing block, try something like this:

            <div class="image-stack">
            <img src="..." />
            <img src="..." />
            ...
            </div>

            .image-stack {
            position: relative;
            /* Use whatever size you want: */
            width: 500px;
            height: 500px;
            }
            .image-stack img {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            }

            In this case, the images need to be listed in order from bottom to top; each subsequent image will appear on top of the previous image. Another option would be to use multiple background images:

            <div class="image-stack"></div>

            .image-stack {
            /* Use whatever size you want: */
            width: 500px;
            height: 500px;

            background-image: url('...'), url('...'), ...;
            

            }

            NB: In this case, the images need to be listed in order from top to bottom. Using multiple backgrounds - CSS: Cascading Style Sheets | MDN[^]


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            C Offline
            C Offline
            clemenslinders
            wrote on last edited by
            #5

            Hi Richard, Thanks for your effort. I currently have no development PC at my disposal. But it looks very easy and logical. I will give this a try asap and I expect no troubles. Kind regards, Clemens Linders

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups