Random Photo Colors and Sizes
See original GitHub issueI see that I can create a photo with a certain color and size like this:
class MyFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.MyModel
the_image = factory.django.ImageField(color='blue')
Is it possible to randomize that color and also the dimensions?
More generally, this means using one declaration as the input to another declaration in generation.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Dynamic Dummy Image Generator - DummyImage.com
Colors. background color / text color. Colors are represented as hex codes (#ffffff is white); Colors always ... Standard image sizes are also...
Read more >Generate a Random Image
This tool generates random images. It randomly fills pixels with the colors you have specified in the Image Colors option section above. The...
Read more >32059 Random Size Images, Stock Photos & Vectors
Random Size royalty-free images. 32,059 random size stock photos, vectors, and illustrations are available royalty-free. See random size stock video clips.
Read more >1340 Random Colours Stock Photos, Images & Pictures
Download Random Colours stock photos. Free or royalty-free photos and images. Use them in commercial designs under lifetime, perpetual & worldwide rights.
Read more >Image Picker Wheel - Pick a Random Image by Spinning
Image Picker Wheel is a special random image generator to pick a random picture from a list of ... Relationship Between Image Background...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Custom workaround for this issue is override
ImageField
& if any callable pass call it run time& use it as
here
faker.safe_color_name
is function that generate random color nameI’ve found the same can be done by overriding
generate
method:Seeing how
generate
doesn’t start with an underscore make it feel like a more legitimate/safe way. But if you want to persist the generated values in the model (it has corresponding fields), you can replace:with:
Or better using
evaluate
: