# Custom parameters for formatting images

I am a LaTeX newbie working on creating my first custom LaTeX class. I would like to know if it's possible to define parameters for `\includegraphics` such as `width`, `height`, `center`/`right align` etc in the custom class, so that I don't have to retype all this for each of the image that I insert.

-
`\includegraphics` does not provide `center` or `right align` keys. What are you referring to specifically regarding this horizontal alignment? This may be something to do with a `figure` environment? –  Werner Feb 19 '13 at 7:02
What I meant was, is there a way to ensure that each of the image that I insert in the document is always of a particular size, and always aligned right? –  pyro Feb 19 '13 at 7:06

``````\newcommand{\mygraphic}[2][,]{% \mygraphic[<opt args>]{<file>}
To this you can add `\centering` or `\raggedleft` (for right alignment) or `\raggedright` (for left alignment), perhaps grouped, depending on the exact usage of `\mygraphics`.
In particular, the above definition `\mygraphic[<opt args>]{<file>}` takes an optional first argument where the default image width/height is `\linewidth`/`50pt`. Otherwise, you can override this with your own setting, or add other options.