Retrieve exact image match using public api while specifying all option parameters? #216
-
Hello, great project. I have a little program that generates images locally, saves the options present in each image, and constructs a url for your public api at https://avatars.dicebear.com/api/ with all the options as parameters. I've noticed that the images returned from the public api aren't an exact match with the option parameters as specified in the url. It seems like some parameters are respected, others not. My questions: 1) Is this expected behavior, or am I doing something wrong? 2) Either way, is there an alternate method to accomplish this? Examples:
I've also tried: 3) Using the open-peeps style instead, with similar results (i.e. some parameters take, others not); 4) Constructing each parameter with '[]' notation as I saw somewhere in your docs; 5) Different settings for :seed.svg. In the end I just removed the seed entirely in case that was getting in the way. Thank you very much for any info. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @bmm-brobbins 😃 if you want to get the same result guaranteed, make sure you use the same seed. In your example URL, the seed is an empty string. If you don't specify one locally, it is a random value, so you can get different results. See example 1: Alternatively, you really need to set all options. This also includes the probability. Some elements are only displayed with a probability calculated on the seed. See example 2: |
Beta Was this translation helpful? Give feedback.
Hi @bmm-brobbins 😃
if you want to get the same result guaranteed, make sure you use the same seed. In your example URL, the seed is an empty string. If you don't specify one locally, it is a random value, so you can get different results.
See example 1:
https://codesandbox.io/s/dicebear-215-u6vtxy?file=/index.ts
Alternatively, you really need to set all options. This also includes the probability. Some elements are only displayed with a probability calculated on the seed.
See example 2:
https://codesandbox.io/s/dicebear-215-u6vtxy?file=/index.ts