Answers.Body: <p>I found some answers in this post right here: <a href="https://github.com/craftcms/cms/issues/11982" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/11982</a> although it still seems like GQL srcset is highly unflexible. But maybe this helps someone:</p>
  <pre><code>myTransformHandle: image @transform(handle: &quot;myTransformHandle&quot;) {    
      srcset(sizes:[&quot;1x&quot;,&quot;2x&quot;])
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-14T06:38:04.657Z
Answers.LastActivityDate: 2023-08-14T06:38:04.657Z
Answers.UserDisplayName: thomas
Answers.Body: <p>Inside asset interface you can put the srcset field, here is an example:</p>
  <pre><code>{
    asset {
      srcset(sizes:[&quot;1x&quot;, &quot;1.5x&quot;, &quot;2x&quot;])
    }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-14T03:08:00.790Z
Answers.LastActivityDate: 2023-08-14T03:08:00.790Z
Answers.UserDisplayName: aodihis
Body: <p>I am trying to fetch srcset with GraphQL from Craft4 but I don't really understand the syntax. In my twig Templates I use <code>image.getSrcset(['1x','2x'],'myTransformHandle')</code> and I'm trying to translate that to GraphQl<br />
  If I use <code>srcset(sizes: [&quot;1x&quot;,&quot;2x&quot;])</code> it returns a set with the original image and one upscaled to double the size which doesn't seem that useful.<br />
  Has anyone worked with this and knows how to get a useful result?<br />
  Thanks</p>
  
Tags: <assets><craft4><graphql>
Title: GraphQL queries for srcset
ThreadText: # GraphQL queries for srcset
  
  (Asked by: username_0 on 2023-08-11)
  
  I am trying to fetch srcset with GraphQL from Craft4 but I don't really understand the syntax. In my twig Templates I use `image.getSrcset(['1x','2x'],'myTransformHandle')` and I'm trying to translate that to GraphQl  
  If I use `srcset(sizes: ["1x","2x"])` it returns a set with the original image and one upscaled to double the size which doesn't seem that useful.  
  Has anyone worked with this and knows how to get a useful result?  
  Thanks
  
  **Tags:** assets, craft4, graphql
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2023-08-14. Score: 1 | Accepted answer
  
  I found some answers in this post right here: <https://github.com/craftcms/cms/issues/11982> although it still seems like GQL srcset is highly unflexible. But maybe this helps someone:
  
  ```
  myTransformHandle: image @transform(handle: "myTransformHandle") {    
      srcset(sizes:["1x","2x"])
  }
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2023-08-14. Score: 1
  
  Inside asset interface you can put the srcset field, here is an example:
  
  ```
  {
    asset {
      srcset(sizes:["1x", "1.5x", "2x"])
    }
  }
  
  ```
  
  
  ---
  
  