Solution: Image resizing by URL parameter
When using Pollinations to generate images, the default resolution may not be sufficient. The resolution can be customized by the following methods:
- Base Adjustment:Add directly to the URL
&width=数值&height=数值parameters, such ashttps://pollinations.ai/p/城市夜景&width=1024&height=768 - Maintain proportions:It is recommended to use standard ratios (16:9/4:3) to avoid distortion, and you can specify only the width such as
&width=1200 - API calls:Python requests can pass size values via the params parameter:
params={'width':1600,'height':900} response=requests.get(url,params=params) - React Integration:utilization
usePollinationsImageWhen hooked, the size is set via the options object:const imageUrl=usePollinationsImage('主题',{width:800,height:600})
Note: Over-sizing may result in longer generation time, it is recommended to test the right size first.
This answer comes from the articlePollinations: free big model services in the form of URL splicing and APIsThe































