This works with the normal password authentication, you need to adapt it to openid which I don't use and most certainly you will have to change options for this to work with curl.
1. wget --save-cookies=z.coo -4 --keep-session-cookies -O - -S --post-data='name=(a zabbix username)&password=(password)&enter=Enter' 'http://example.com/zabbix/index.php?login=1'
2. wget -4 --load-cookies=z.coo -O result.png 'http://example.com/zabbix/chart2.php?graphid=410&width=1778&period=102105&stime=20121129005934'
the first one posts authentication and saves the cookie. the second loads the same cookie file and retrieves the png.
You must certainly want to implement it without using shell but in a language of your preference and zabbix's JSON-RPC API of which there are plenty of client libraries already.
Though AFAIK you still will have to login like this to get the graph's image. At least for the time being.
EDIT: https://support.zabbix.com/browse/ZBXNEXT-562 is the one to vote (or start working on it)