Question 109 of the Westminster Larger Catechism forbids the making of images of God, including mental images:
The sins forbidden in the second commandment are, all devising, counseling, commanding, using, and any wise approving, any religious worship not instituted by God himself; the making any representation of God, of all or of any of the three persons, either inwardly in our mind, or outwardly in any kind of image or likeness of any creature whatsoever
J. Douma, in his book The Ten Commandments: Manual for the Christian Life, makes the following interesting observation:
If you are interested in the relevance of the second commandment, you must not restrict it to the idol images mentioned in the commandment, but ask whether, apart from materials like wood, stone, or paint, you construct wrong mental images of God. For then you are doing exactly what the image-making craftsmen were doing in the Old Testament world: fashioning God according to your own understanding.
In the discussion which follows, he specifically cites Psalm 50:21 — “You thought that I was just like you.” He states:
Here again we are confronted squarely with the original sin against the second commandment: a person leads his own life, imagining that God bestows His approval automatically. Instead of believing that God created man after His image — so that He may demand of him a believing and holy life-style — man creates God in his image, ready to serve his own ambitions.
If we imagine God to be something that He is not, then we are thinking sinfully, and we are breaking the Second Commandment. The solution is to return to God’s word, for it is there that we see God as He really is.